diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 207e867f8dae6..3f4dad0f361ca 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -322,6 +322,7 @@ com.azure.resourcemanager:azure-resourcemanager-extendedlocation;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md new file mode 100644 index 0000000000000..186caa5cad062 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-11-09) + +- Azure Resource Manager CosmosDB client library for Java. This package contains Microsoft Azure SDK for CosmosDB Management SDK. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-07-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md new file mode 100644 index 0000000000000..3bd6c147545a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager CosmosDB client library for Java + +Azure Resource Manager CosmosDB client library for Java. + +This package contains Microsoft Azure SDK for CosmosDB Management SDK. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-07-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-cosmos-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-cosmos-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CosmosDBManager manager = CosmosDBManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md b/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md new file mode 100644 index 0000000000000..3da1feafa4e79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/SAMPLE.md @@ -0,0 +1,5720 @@ +# Code snippets and samples + + +## CassandraClusters + +- [CreateUpdate](#cassandraclusters_createupdate) +- [Delete](#cassandraclusters_delete) +- [FetchNodeStatus](#cassandraclusters_fetchnodestatus) +- [GetBackup](#cassandraclusters_getbackup) +- [GetByResourceGroup](#cassandraclusters_getbyresourcegroup) +- [List](#cassandraclusters_list) +- [ListBackups](#cassandraclusters_listbackups) +- [ListByResourceGroup](#cassandraclusters_listbyresourcegroup) +- [RequestRepair](#cassandraclusters_requestrepair) +- [Update](#cassandraclusters_update) + +## CassandraDataCenters + +- [CreateUpdate](#cassandradatacenters_createupdate) +- [Delete](#cassandradatacenters_delete) +- [Get](#cassandradatacenters_get) +- [List](#cassandradatacenters_list) +- [Update](#cassandradatacenters_update) + +## CassandraResources + +- [CreateUpdateCassandraKeyspace](#cassandraresources_createupdatecassandrakeyspace) +- [CreateUpdateCassandraTable](#cassandraresources_createupdatecassandratable) +- [CreateUpdateCassandraView](#cassandraresources_createupdatecassandraview) +- [DeleteCassandraKeyspace](#cassandraresources_deletecassandrakeyspace) +- [DeleteCassandraTable](#cassandraresources_deletecassandratable) +- [DeleteCassandraView](#cassandraresources_deletecassandraview) +- [GetCassandraKeyspace](#cassandraresources_getcassandrakeyspace) +- [GetCassandraKeyspaceThroughput](#cassandraresources_getcassandrakeyspacethroughput) +- [GetCassandraTable](#cassandraresources_getcassandratable) +- [GetCassandraTableThroughput](#cassandraresources_getcassandratablethroughput) +- [GetCassandraView](#cassandraresources_getcassandraview) +- [GetCassandraViewThroughput](#cassandraresources_getcassandraviewthroughput) +- [ListCassandraKeyspaces](#cassandraresources_listcassandrakeyspaces) +- [ListCassandraTables](#cassandraresources_listcassandratables) +- [ListCassandraViews](#cassandraresources_listcassandraviews) +- [MigrateCassandraKeyspaceToAutoscale](#cassandraresources_migratecassandrakeyspacetoautoscale) +- [MigrateCassandraKeyspaceToManualThroughput](#cassandraresources_migratecassandrakeyspacetomanualthroughput) +- [MigrateCassandraTableToAutoscale](#cassandraresources_migratecassandratabletoautoscale) +- [MigrateCassandraTableToManualThroughput](#cassandraresources_migratecassandratabletomanualthroughput) +- [MigrateCassandraViewToAutoscale](#cassandraresources_migratecassandraviewtoautoscale) +- [MigrateCassandraViewToManualThroughput](#cassandraresources_migratecassandraviewtomanualthroughput) +- [UpdateCassandraKeyspaceThroughput](#cassandraresources_updatecassandrakeyspacethroughput) +- [UpdateCassandraTableThroughput](#cassandraresources_updatecassandratablethroughput) +- [UpdateCassandraViewThroughput](#cassandraresources_updatecassandraviewthroughput) + +## Collection + +- [ListMetricDefinitions](#collection_listmetricdefinitions) +- [ListMetrics](#collection_listmetrics) +- [ListUsages](#collection_listusages) + +## CollectionPartition + +- [ListMetrics](#collectionpartition_listmetrics) +- [ListUsages](#collectionpartition_listusages) + +## CollectionPartitionRegion + +- [ListMetrics](#collectionpartitionregion_listmetrics) + +## CollectionRegion + +- [ListMetrics](#collectionregion_listmetrics) + +## Database + +- [ListMetricDefinitions](#database_listmetricdefinitions) +- [ListMetrics](#database_listmetrics) +- [ListUsages](#database_listusages) + +## DatabaseAccountRegion + +- [ListMetrics](#databaseaccountregion_listmetrics) + +## DatabaseAccounts + +- [CheckNameExists](#databaseaccounts_checknameexists) +- [CreateOrUpdate](#databaseaccounts_createorupdate) +- [Delete](#databaseaccounts_delete) +- [FailoverPriorityChange](#databaseaccounts_failoverprioritychange) +- [GetByResourceGroup](#databaseaccounts_getbyresourcegroup) +- [GetReadOnlyKeys](#databaseaccounts_getreadonlykeys) +- [List](#databaseaccounts_list) +- [ListByResourceGroup](#databaseaccounts_listbyresourcegroup) +- [ListConnectionStrings](#databaseaccounts_listconnectionstrings) +- [ListKeys](#databaseaccounts_listkeys) +- [ListMetricDefinitions](#databaseaccounts_listmetricdefinitions) +- [ListMetrics](#databaseaccounts_listmetrics) +- [ListReadOnlyKeys](#databaseaccounts_listreadonlykeys) +- [ListUsages](#databaseaccounts_listusages) +- [OfflineRegion](#databaseaccounts_offlineregion) +- [OnlineRegion](#databaseaccounts_onlineregion) +- [RegenerateKey](#databaseaccounts_regeneratekey) +- [Update](#databaseaccounts_update) + +## GraphResources + +- [CreateUpdateGraph](#graphresources_createupdategraph) +- [DeleteGraphResource](#graphresources_deletegraphresource) +- [GetGraph](#graphresources_getgraph) +- [ListGraphs](#graphresources_listgraphs) + +## GremlinResources + +- [CreateUpdateGremlinDatabase](#gremlinresources_createupdategremlindatabase) +- [CreateUpdateGremlinGraph](#gremlinresources_createupdategremlingraph) +- [DeleteGremlinDatabase](#gremlinresources_deletegremlindatabase) +- [DeleteGremlinGraph](#gremlinresources_deletegremlingraph) +- [GetGremlinDatabase](#gremlinresources_getgremlindatabase) +- [GetGremlinDatabaseThroughput](#gremlinresources_getgremlindatabasethroughput) +- [GetGremlinGraph](#gremlinresources_getgremlingraph) +- [GetGremlinGraphThroughput](#gremlinresources_getgremlingraphthroughput) +- [ListGremlinDatabases](#gremlinresources_listgremlindatabases) +- [ListGremlinGraphs](#gremlinresources_listgremlingraphs) +- [MigrateGremlinDatabaseToAutoscale](#gremlinresources_migrategremlindatabasetoautoscale) +- [MigrateGremlinDatabaseToManualThroughput](#gremlinresources_migrategremlindatabasetomanualthroughput) +- [MigrateGremlinGraphToAutoscale](#gremlinresources_migrategremlingraphtoautoscale) +- [MigrateGremlinGraphToManualThroughput](#gremlinresources_migrategremlingraphtomanualthroughput) +- [UpdateGremlinDatabaseThroughput](#gremlinresources_updategremlindatabasethroughput) +- [UpdateGremlinGraphThroughput](#gremlinresources_updategremlingraphthroughput) + +## MongoDBResources + +- [CreateUpdateMongoDBCollection](#mongodbresources_createupdatemongodbcollection) +- [CreateUpdateMongoDBDatabase](#mongodbresources_createupdatemongodbdatabase) +- [DeleteMongoDBCollection](#mongodbresources_deletemongodbcollection) +- [DeleteMongoDBDatabase](#mongodbresources_deletemongodbdatabase) +- [GetMongoDBCollection](#mongodbresources_getmongodbcollection) +- [GetMongoDBCollectionThroughput](#mongodbresources_getmongodbcollectionthroughput) +- [GetMongoDBDatabase](#mongodbresources_getmongodbdatabase) +- [GetMongoDBDatabaseThroughput](#mongodbresources_getmongodbdatabasethroughput) +- [ListMongoDBCollections](#mongodbresources_listmongodbcollections) +- [ListMongoDBDatabases](#mongodbresources_listmongodbdatabases) +- [MigrateMongoDBCollectionToAutoscale](#mongodbresources_migratemongodbcollectiontoautoscale) +- [MigrateMongoDBCollectionToManualThroughput](#mongodbresources_migratemongodbcollectiontomanualthroughput) +- [MigrateMongoDBDatabaseToAutoscale](#mongodbresources_migratemongodbdatabasetoautoscale) +- [MigrateMongoDBDatabaseToManualThroughput](#mongodbresources_migratemongodbdatabasetomanualthroughput) +- [UpdateMongoDBCollectionThroughput](#mongodbresources_updatemongodbcollectionthroughput) +- [UpdateMongoDBDatabaseThroughput](#mongodbresources_updatemongodbdatabasethroughput) + +## NotebookWorkspaces + +- [CreateOrUpdate](#notebookworkspaces_createorupdate) +- [Delete](#notebookworkspaces_delete) +- [Get](#notebookworkspaces_get) +- [ListByDatabaseAccount](#notebookworkspaces_listbydatabaseaccount) +- [ListConnectionInfo](#notebookworkspaces_listconnectioninfo) +- [RegenerateAuthToken](#notebookworkspaces_regenerateauthtoken) +- [Start](#notebookworkspaces_start) + +## Operations + +- [List](#operations_list) + +## PartitionKeyRangeId + +- [ListMetrics](#partitionkeyrangeid_listmetrics) + +## PartitionKeyRangeIdRegion + +- [ListMetrics](#partitionkeyrangeidregion_listmetrics) + +## Percentile + +- [ListMetrics](#percentile_listmetrics) + +## PercentileSourceTarget + +- [ListMetrics](#percentilesourcetarget_listmetrics) + +## PercentileTarget + +- [ListMetrics](#percentiletarget_listmetrics) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByDatabaseAccount](#privateendpointconnections_listbydatabaseaccount) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByDatabaseAccount](#privatelinkresources_listbydatabaseaccount) + +## ResourceProvider + +- [List](#resourceprovider_list) +- [LocationGet](#resourceprovider_locationget) + +## RestorableDatabaseAccounts + +- [GetByLocation](#restorabledatabaseaccounts_getbylocation) +- [List](#restorabledatabaseaccounts_list) +- [ListByLocation](#restorabledatabaseaccounts_listbylocation) + +## RestorableMongodbCollections + +- [List](#restorablemongodbcollections_list) + +## RestorableMongodbDatabases + +- [List](#restorablemongodbdatabases_list) + +## RestorableMongodbResources + +- [List](#restorablemongodbresources_list) + +## RestorableSqlContainers + +- [List](#restorablesqlcontainers_list) + +## RestorableSqlDatabases + +- [List](#restorablesqldatabases_list) + +## RestorableSqlResources + +- [List](#restorablesqlresources_list) + +## Service + +- [Create](#service_create) +- [Delete](#service_delete) +- [Get](#service_get) +- [List](#service_list) + +## SqlResources + +- [CreateUpdateSqlContainer](#sqlresources_createupdatesqlcontainer) +- [CreateUpdateSqlDatabase](#sqlresources_createupdatesqldatabase) +- [CreateUpdateSqlRoleAssignment](#sqlresources_createupdatesqlroleassignment) +- [CreateUpdateSqlRoleDefinition](#sqlresources_createupdatesqlroledefinition) +- [CreateUpdateSqlStoredProcedure](#sqlresources_createupdatesqlstoredprocedure) +- [CreateUpdateSqlTrigger](#sqlresources_createupdatesqltrigger) +- [CreateUpdateSqlUserDefinedFunction](#sqlresources_createupdatesqluserdefinedfunction) +- [DeleteSqlContainer](#sqlresources_deletesqlcontainer) +- [DeleteSqlDatabase](#sqlresources_deletesqldatabase) +- [DeleteSqlRoleAssignment](#sqlresources_deletesqlroleassignment) +- [DeleteSqlRoleDefinition](#sqlresources_deletesqlroledefinition) +- [DeleteSqlStoredProcedure](#sqlresources_deletesqlstoredprocedure) +- [DeleteSqlTrigger](#sqlresources_deletesqltrigger) +- [DeleteSqlUserDefinedFunction](#sqlresources_deletesqluserdefinedfunction) +- [GetSqlContainer](#sqlresources_getsqlcontainer) +- [GetSqlContainerThroughput](#sqlresources_getsqlcontainerthroughput) +- [GetSqlDatabase](#sqlresources_getsqldatabase) +- [GetSqlDatabaseThroughput](#sqlresources_getsqldatabasethroughput) +- [GetSqlRoleAssignment](#sqlresources_getsqlroleassignment) +- [GetSqlRoleDefinition](#sqlresources_getsqlroledefinition) +- [GetSqlStoredProcedure](#sqlresources_getsqlstoredprocedure) +- [GetSqlTrigger](#sqlresources_getsqltrigger) +- [GetSqlUserDefinedFunction](#sqlresources_getsqluserdefinedfunction) +- [ListSqlContainers](#sqlresources_listsqlcontainers) +- [ListSqlDatabases](#sqlresources_listsqldatabases) +- [ListSqlRoleAssignments](#sqlresources_listsqlroleassignments) +- [ListSqlRoleDefinitions](#sqlresources_listsqlroledefinitions) +- [ListSqlStoredProcedures](#sqlresources_listsqlstoredprocedures) +- [ListSqlTriggers](#sqlresources_listsqltriggers) +- [ListSqlUserDefinedFunctions](#sqlresources_listsqluserdefinedfunctions) +- [MigrateSqlContainerToAutoscale](#sqlresources_migratesqlcontainertoautoscale) +- [MigrateSqlContainerToManualThroughput](#sqlresources_migratesqlcontainertomanualthroughput) +- [MigrateSqlDatabaseToAutoscale](#sqlresources_migratesqldatabasetoautoscale) +- [MigrateSqlDatabaseToManualThroughput](#sqlresources_migratesqldatabasetomanualthroughput) +- [RetrieveContinuousBackupInformation](#sqlresources_retrievecontinuousbackupinformation) +- [UpdateSqlContainerThroughput](#sqlresources_updatesqlcontainerthroughput) +- [UpdateSqlDatabaseThroughput](#sqlresources_updatesqldatabasethroughput) + +## TableResources + +- [CreateUpdateTable](#tableresources_createupdatetable) +- [DeleteTable](#tableresources_deletetable) +- [GetTable](#tableresources_gettable) +- [GetTableThroughput](#tableresources_gettablethroughput) +- [ListTables](#tableresources_listtables) +- [MigrateTableToAutoscale](#tableresources_migratetabletoautoscale) +- [MigrateTableToManualThroughput](#tableresources_migratetabletomanualthroughput) +- [UpdateTableThroughput](#tableresources_updatetablethroughput) +### CassandraClusters_CreateUpdate + +```java +import com.azure.resourcemanager.cosmos.generated.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.generated.models.Certificate; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters CreateUpdate. */ +public final class CassandraClustersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .define("cassandra-prod") + .withRegion("West US") + .withExistingResourceGroup("cassandra-prod-rg") + .withTags(mapOf()) + .withProperties( + new ClusterResourceProperties() + .withDelegatedManagementSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management") + .withCassandraVersion("3.11") + .withClusterNameOverride("ClusterNameIllegalForAzureResource") + .withAuthenticationMethod(AuthenticationMethod.CASSANDRA) + .withInitialCassandraAdminPassword("mypassword") + .withHoursBetweenBackups(24) + .withClientCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraClusters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Delete. */ +public final class CassandraClustersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().delete("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} +``` + +### CassandraClusters_FetchNodeStatus + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters FetchNodeStatus. */ +public final class CassandraClustersFetchNodeStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterFetchNodeStatus.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterFetchNodeStatus. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterFetchNodeStatus( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().fetchNodeStatus("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} +``` + +### CassandraClusters_GetBackup + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters GetBackup. */ +public final class CassandraClustersGetBackupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraBackup.json + */ + /** + * Sample code: CosmosDBManagedCassandraBackup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraBackup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .getBackupWithResponse("cassandra-prod-rg", "cassandra-prod", "1611250348", Context.NONE); + } +} +``` + +### CassandraClusters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters GetByResourceGroup. */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().getByResourceGroupWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} +``` + +### CassandraClusters_List + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters List. */ +public final class CassandraClustersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListBySubscription. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterListBySubscription( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().list(Context.NONE); + } +} +``` + +### CassandraClusters_ListBackups + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters ListBackups. */ +public final class CassandraClustersListBackupsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraBackupsList.json + */ + /** + * Sample code: CosmosDBManagedCassandraBackupsList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraBackupsList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().listBackups("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} +``` + +### CassandraClusters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraClusters ListByResourceGroup. */ +public final class CassandraClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListByResourceGroup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterListByResourceGroup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().listByResourceGroup("cassandra-prod-rg", Context.NONE); + } +} +``` + +### CassandraClusters_RequestRepair + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; +import java.util.Arrays; + +/** Samples for CassandraClusters RequestRepair. */ +public final class CassandraClustersRequestRepairSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraRepair.json + */ + /** + * Sample code: CosmosDBManagedCassandraRepair. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraRepair( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .requestRepair( + "cassandra-prod-rg", + "cassandra-prod", + new RepairPostBody().withKeyspace("my-keyspace").withTables(Arrays.asList("table1", "table42")), + Context.NONE); + } +} +``` + +### CassandraClusters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.generated.models.Certificate; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters Update. */ +public final class CassandraClustersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterPatch. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterPatch( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + ClusterResource resource = + manager + .cassandraClusters() + .getByResourceGroupWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("owner", "mike")) + .withProperties( + new ClusterResourceProperties() + .withAuthenticationMethod(AuthenticationMethod.NONE) + .withHoursBetweenBackups(12) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4")))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraDataCenters_CreateUpdate + +```java +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters CreateUpdate. */ +public final class CassandraDataCentersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraDataCenters() + .define("dc1") + .withExistingCassandraCluster("cassandra-prod-rg", "cassandra-prod") + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")) + .create(); + } +} +``` + +### CassandraDataCenters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Delete. */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().delete("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} +``` + +### CassandraDataCenters_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Get. */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().getWithResponse("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} +``` + +### CassandraDataCenters_List + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters List. */ +public final class CassandraDataCentersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterList.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().list("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} +``` + +### CassandraDataCenters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters Update. */ +public final class CassandraDataCentersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + DataCenterResource resource = + manager + .cassandraDataCenters() + .getWithResponse("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")) + .apply(); + } +} +``` + +### CassandraResources_CreateUpdateCassandraKeyspace + +```java +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraKeyspace. */ +public final class CassandraResourcesCreateUpdateCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraKeyspace("keyspaceName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new CassandraKeyspaceResource().withId("keyspaceName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraResources_CreateUpdateCassandraTable + +```java +import com.azure.resourcemanager.cosmos.generated.models.CassandraPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CassandraSchema; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterKey; +import com.azure.resourcemanager.cosmos.generated.models.Column; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraTable. */ +public final class CassandraResourcesCreateUpdateCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraTable("tableName") + .withRegion("West US") + .withExistingCassandraKeyspace("rg1", "ddb1", "keyspaceName") + .withResource( + new CassandraTableResource() + .withId("tableName") + .withDefaultTtl(100) + .withSchema( + new CassandraSchema() + .withColumns(Arrays.asList(new Column().withName("columnA").withType("Ascii"))) + .withPartitionKeys(Arrays.asList(new CassandraPartitionKey().withName("columnA"))) + .withClusterKeys(Arrays.asList(new ClusterKey().withName("columnA").withOrderBy("Asc")))) + .withAnalyticalStorageTtl(500)) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraResources_CreateUpdateCassandraView + +```java +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraView. */ +public final class CassandraResourcesCreateUpdateCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraViewCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraView("viewname") + .withRegion((String) null) + .withExistingCassandraKeyspace("rg1", "ddb1", "keyspacename") + .withResource( + new CassandraViewResource() + .withId("viewname") + .withViewDefinition( + "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND" + + " columnc IS NOT NULL PRIMARY (columnc, columna)")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraResources_DeleteCassandraKeyspace + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraKeyspace. */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceDelete.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraKeyspace("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_DeleteCassandraTable + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraTable. */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableDelete.json + */ + /** + * Sample code: CosmosDBCassandraTableDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraTable("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} +``` + +### CassandraResources_DeleteCassandraView + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraView. */ +public final class CassandraResourcesDeleteCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewDelete.json + */ + /** + * Sample code: CosmosDBCassandraViewDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraView("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraKeyspace + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspace. */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().getCassandraKeyspaceWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraKeyspaceThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspaceThroughput. */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraKeyspaceThroughputWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraTable + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTable. */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableGet.json + */ + /** + * Sample code: CosmosDBCassandraTableGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraTableWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraTableThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTableThroughput. */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraTableThroughputWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraView + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraView. */ +public final class CassandraResourcesGetCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewGet.json + */ + /** + * Sample code: CosmosDBCassandraViewGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraViewWithResponse("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} +``` + +### CassandraResources_GetCassandraViewThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraViewThroughput. */ +public final class CassandraResourcesGetCassandraViewThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraViewThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraViewThroughputWithResponse("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} +``` + +### CassandraResources_ListCassandraKeyspaces + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraKeyspaces. */ +public final class CassandraResourcesListCassandraKeyspacesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceList.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraKeyspaces("rgName", "ddb1", Context.NONE); + } +} +``` + +### CassandraResources_ListCassandraTables + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraTables. */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableList.json + */ + /** + * Sample code: CosmosDBCassandraTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraTables("rgName", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_ListCassandraViews + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraViews. */ +public final class CassandraResourcesListCassandraViewsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewList.json + */ + /** + * Sample code: CosmosDBCassandraViewList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraViews("rgName", "ddb1", "keyspacename", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraKeyspaceToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().migrateCassandraKeyspaceToAutoscale("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraKeyspaceToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraKeyspaceToManualThroughput("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraTableToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToAutoscale. */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraTableToAutoscale("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraTableToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraTableToManualThroughput("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraViewToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraViewToAutoscale. */ +public final class CassandraResourcesMigrateCassandraViewToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraViewMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraViewToAutoscale("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} +``` + +### CassandraResources_MigrateCassandraViewToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraViewToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraViewToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraViewMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraViewToManualThroughput("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} +``` + +### CassandraResources_UpdateCassandraKeyspaceThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraKeyspaceThroughput. */ +public final class CassandraResourcesUpdateCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraKeyspaceThroughput( + "rg1", + "ddb1", + "keyspaceName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraResources_UpdateCassandraTableThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraTableThroughput. */ +public final class CassandraResourcesUpdateCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraTableThroughput( + "rg1", + "ddb1", + "keyspaceName", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CassandraResources_UpdateCassandraViewThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraViewThroughput. */ +public final class CassandraResourcesUpdateCassandraViewThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraViewThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraViewThroughput( + "rg1", + "ddb1", + "keyspacename", + "viewname", + new ThroughputSettingsUpdateParameters() + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Collection_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for Collection ListMetricDefinitions. */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBCollectionGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.collections().listMetricDefinitions("rg1", "ddb1", "databaseRid", "collectionRid", Context.NONE); + } +} +``` + +### Collection_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for Collection ListMetrics. */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBCollectionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collections() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### Collection_ListUsages + +```java +import com.azure.core.util.Context; + +/** Samples for Collection ListUsages. */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collections() + .listUsages("rg1", "ddb1", "databaseRid", "collectionRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} +``` + +### CollectionPartition_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListMetrics. */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitions() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} +``` + +### CollectionPartition_ListUsages + +```java +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListUsages. */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitions() + .listUsages( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=name.value eq 'Partition Storage'", + Context.NONE); + } +} +``` + +### CollectionPartitionRegion_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for CollectionPartitionRegion ListMetrics. */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} +``` + +### CollectionRegion_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for CollectionRegion ListMetrics. */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRegionCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBRegionCollectionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRegionCollectionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### Database_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for Database ListMetricDefinitions. */ +public final class DatabaseListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databases().listMetricDefinitions("rg1", "ddb1", "databaseRid", Context.NONE); + } +} +``` + +### Database_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for Database ListMetrics. */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetMetrics(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databases() + .listMetrics( + "rg1", + "ddb1", + "rid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### Database_ListUsages + +```java +import com.azure.core.util.Context; + +/** Samples for Database ListUsages. */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databases().listUsages("rg1", "ddb1", "databaseRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} +``` + +### DatabaseAccountRegion_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccountRegion ListMetrics. */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccountRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### DatabaseAccounts_CheckNameExists + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts CheckNameExists. */ +public final class DatabaseAccountsCheckNameExistsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCheckNameExists. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCheckNameExists( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().checkNameExistsWithResponse("ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_CreateOrUpdate + +```java +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.generated.models.RestoreMode; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.ServerVersion; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts CreateOrUpdate. */ +public final class DatabaseAccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json + */ + /** + * Sample code: CosmosDBRestoreDatabaseAccountCreateUpdate.json. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestoreDatabaseAccountCreateUpdateJson( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withCreateMode(CreateMode.RESTORE) + .withTags(mapOf()) + .withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withBackupPolicy(new ContinuousModeBackupPolicy()) + .withRestoreParameters( + new RestoreParameters() + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withDatabasesToRestore( + Arrays + .asList( + new DatabaseRestoreResourceInner() + .withDatabaseName("db1") + .withCollectionNames(Arrays.asList("collection1", "collection2")), + new DatabaseRestoreResourceInner() + .withDatabaseName("db2") + .withCollectionNames(Arrays.asList("collection3", "collection4"))))) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCreateMax.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMax. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCreateMax( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false), + new Location().withLocationName("eastus").withFailoverPriority(1).withIsZoneRedundant(false))) + .withCreateMode(CreateMode.DEFAULT) + .withTags(mapOf()) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withKind(DatabaseAccountKind.MONGO_DB) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withDefaultIdentity("FirstPartyIdentity") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(8) + .withBackupStorageRedundancy(BackupStorageRedundancy.GEO))) + .withCors(Arrays.asList(new CorsPolicy().withAllowedOrigins("https://test"))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCreateMin.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMin. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCreateMin( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withCreateMode(CreateMode.DEFAULT) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DatabaseAccounts_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts Delete. */ +public final class DatabaseAccountsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountDelete.json + */ + /** + * Sample code: CosmosDBDatabaseAccountDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().delete("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_FailoverPriorityChange + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import java.util.Arrays; + +/** Samples for DatabaseAccounts FailoverPriorityChange. */ +public final class DatabaseAccountsFailoverPriorityChangeSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json + */ + /** + * Sample code: CosmosDBDatabaseAccountFailoverPriorityChange. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountFailoverPriorityChange( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .failoverPriorityChange( + "rg1", + "ddb1-failover", + new FailoverPolicies() + .withFailoverPolicies( + Arrays + .asList( + new FailoverPolicy().withLocationName("eastus").withFailoverPriority(0), + new FailoverPolicy().withLocationName("westus").withFailoverPriority(1))), + Context.NONE); + } +} +``` + +### DatabaseAccounts_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetByResourceGroup. */ +public final class DatabaseAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_GetReadOnlyKeys + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetReadOnlyKeys. */ +public final class DatabaseAccountsGetReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().getReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_List + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts List. */ +public final class DatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBDatabaseAccountList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().list(Context.NONE); + } +} +``` + +### DatabaseAccounts_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListByResourceGroup. */ +public final class DatabaseAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListByResourceGroup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListByResourceGroup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listByResourceGroup("rg1", Context.NONE); + } +} +``` + +### DatabaseAccounts_ListConnectionStrings + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListConnectionStrings. */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStrings. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListConnectionStrings( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listConnectionStringsWithResponse("rg1", "ddb1", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStringsMongo. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListConnectionStringsMongo( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listConnectionStringsWithResponse("rg1", "mongo-ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_ListKeys + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListKeys. */ +public final class DatabaseAccountsListKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetricDefinitions. */ +public final class DatabaseAccountsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listMetricDefinitions("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetrics. */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### DatabaseAccounts_ListReadOnlyKeys + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListReadOnlyKeys. */ +public final class DatabaseAccountsListReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} +``` + +### DatabaseAccounts_ListUsages + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListUsages. */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetUsages( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listUsages("rg1", "ddb1", "$filter=name.value eq 'Storage'", Context.NONE); + } +} +``` + +### DatabaseAccounts_OfflineRegion + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OfflineRegion. */ +public final class DatabaseAccountsOfflineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOfflineRegion. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountOfflineRegion( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().offlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} +``` + +### DatabaseAccounts_OnlineRegion + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OnlineRegion. */ +public final class DatabaseAccountsOnlineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOnlineRegion. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountOnlineRegion( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().onlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} +``` + +### DatabaseAccounts_RegenerateKey + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.KeyKind; + +/** Samples for DatabaseAccounts RegenerateKey. */ +public final class DatabaseAccountsRegenerateKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegenerateKey. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegenerateKey( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .regenerateKey( + "rg1", "ddb1", new DatabaseAccountRegenerateKeyParameters().withKeyKind(KeyKind.PRIMARY), Context.NONE); + } +} +``` + +### DatabaseAccounts_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.EnableFullTextQuery; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts Update. */ +public final class DatabaseAccountsUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountPatch.json + */ + /** + * Sample code: CosmosDBDatabaseAccountPatch. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountPatch( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + DatabaseAccountGetResults resource = + manager.databaseAccounts().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("dept", "finance")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withDefaultIdentity("FirstPartyIdentity") + .withEnableFreeTier(false) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(720) + .withBackupStorageRedundancy(BackupStorageRedundancy.GEO))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withDiagnosticLogSettings(new DiagnosticLogSettings().withEnableFullTextQuery(EnableFullTextQuery.TRUE)) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### GraphResources_CreateUpdateGraph + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GraphResources CreateUpdateGraph. */ +public final class GraphResourcesCreateUpdateGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceCreateUpdate.json + */ + /** + * Sample code: CosmosDBGraphCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGraphCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .graphResources() + .define("graphName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new GraphResource().withId("graphName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### GraphResources_DeleteGraphResource + +```java +import com.azure.core.util.Context; + +/** Samples for GraphResources DeleteGraphResource. */ +public final class GraphResourcesDeleteGraphResourceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceDelete.json + */ + /** + * Sample code: CosmosDBSqlDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().deleteGraphResource("rg1", "ddb1", "graphName", Context.NONE); + } +} +``` + +### GraphResources_GetGraph + +```java +import com.azure.core.util.Context; + +/** Samples for GraphResources GetGraph. */ +public final class GraphResourcesGetGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().getGraphWithResponse("rg1", "ddb1", "graphName", Context.NONE); + } +} +``` + +### GraphResources_ListGraphs + +```java +import com.azure.core.util.Context; + +/** Samples for GraphResources ListGraphs. */ +public final class GraphResourcesListGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceList.json + */ + /** + * Sample code: CosmosDBSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().listGraphs("rgName", "ddb1", Context.NONE); + } +} +``` + +### GremlinResources_CreateUpdateGremlinDatabase + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinDatabase. */ +public final class GremlinResourcesCreateUpdateGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .defineUpdateGremlinDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new GremlinDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### GremlinResources_CreateUpdateGremlinGraph + +```java +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.DataType; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.generated.models.IncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.IndexKind; +import com.azure.resourcemanager.cosmos.generated.models.Indexes; +import com.azure.resourcemanager.cosmos.generated.models.IndexingMode; +import com.azure.resourcemanager.cosmos.generated.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKind; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKey; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinGraph. */ +public final class GremlinResourcesCreateUpdateGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .defineUpdateGremlinGraph("graphName") + .withRegion("West US") + .withExistingGremlinDatabase("rg1", "ddb1", "databaseName") + .withResource( + new GremlinGraphResource() + .withId("graphName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys(Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### GremlinResources_DeleteGremlinDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinDatabase. */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseDelete.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().deleteGremlinDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_DeleteGremlinGraph + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinGraph. */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphDelete.json + */ + /** + * Sample code: CosmosDBGremlinGraphDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().deleteGremlinGraph("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabase. */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().getGremlinDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinDatabaseThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabaseThroughput. */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinGraph + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraph. */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinGraphWithResponse("rgName", "ddb1", "databaseName", "graphName", Context.NONE); + } +} +``` + +### GremlinResources_GetGremlinGraphThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraphThroughput. */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinGraphThroughputWithResponse("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} +``` + +### GremlinResources_ListGremlinDatabases + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinDatabases. */ +public final class GremlinResourcesListGremlinDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseList.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().listGremlinDatabases("rgName", "ddb1", Context.NONE); + } +} +``` + +### GremlinResources_ListGremlinGraphs + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinGraphs. */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphList.json + */ + /** + * Sample code: CosmosDBGremlinGraphList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().listGremlinGraphs("rgName", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinDatabaseToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().migrateGremlinDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinDatabaseToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinGraphToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToAutoscale. */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinGraphToAutoscale("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} +``` + +### GremlinResources_MigrateGremlinGraphToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinGraphToManualThroughput("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} +``` + +### GremlinResources_UpdateGremlinDatabaseThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinDatabaseThroughput. */ +public final class GremlinResourcesUpdateGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .updateGremlinDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### GremlinResources_UpdateGremlinGraphThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinGraphThroughput. */ +public final class GremlinResourcesUpdateGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .updateGremlinGraphThroughput( + "rg1", + "ddb1", + "databaseName", + "graphName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MongoDBResources_CreateUpdateMongoDBCollection + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndex; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndexKeys; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndexOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBCollection. */ +public final class MongoDBResourcesCreateUpdateMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .defineUpdateMongoDBCollection("collectionName") + .withRegion("West US") + .withExistingMongodbDatabase("rg1", "ddb1", "databaseName") + .withResource( + new MongoDBCollectionResource() + .withId("collectionName") + .withShardKey(mapOf("testKey", "Hash")) + .withIndexes( + Arrays + .asList( + new MongoIndex() + .withKey(new MongoIndexKeys().withKeys(Arrays.asList("_ts"))) + .withOptions(new MongoIndexOptions().withExpireAfterSeconds(100).withUnique(true)), + new MongoIndex().withKey(new MongoIndexKeys().withKeys(Arrays.asList("_id"))))) + .withAnalyticalStorageTtl(500)) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MongoDBResources_CreateUpdateMongoDBDatabase + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBDatabase. */ +public final class MongoDBResourcesCreateUpdateMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .defineUpdateMongoDBDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new MongoDBDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MongoDBResources_DeleteMongoDBCollection + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBCollection. */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .deleteMongoDBCollection("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} +``` + +### MongoDBResources_DeleteMongoDBDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBDatabase. */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseDelete.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().deleteMongoDBDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBCollection + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollection. */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBCollectionWithResponse("rgName", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBCollectionThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollectionThroughput. */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBCollectionThroughputWithResponse("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabase. */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().getMongoDBDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_GetMongoDBDatabaseThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoDBCollections + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBCollections. */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionList.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().listMongoDBCollections("rgName", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_ListMongoDBDatabases + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBDatabases. */ +public final class MongoDBResourcesListMongoDBDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseList.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().listMongoDBDatabases("rgName", "ddb1", Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBCollectionToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBCollectionToAutoscale("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBCollectionToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBCollectionToManualThroughput("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBDatabaseToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().migrateMongoDBDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_MigrateMongoDBDatabaseToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### MongoDBResources_UpdateMongoDBCollectionThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBCollectionThroughput. */ +public final class MongoDBResourcesUpdateMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .updateMongoDBCollectionThroughput( + "rg1", + "ddb1", + "databaseName", + "collectionName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MongoDBResources_UpdateMongoDBDatabaseThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .updateMongoDBDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### NotebookWorkspaces_CreateOrUpdate + +```java +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces CreateOrUpdate. */ +public final class NotebookWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceCreate.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .notebookWorkspaces() + .define(NotebookWorkspaceName.DEFAULT) + .withExistingDatabaseAccount("rg1", "ddb1") + .create(); + } +} +``` + +### NotebookWorkspaces_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Delete. */ +public final class NotebookWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceDelete.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().delete("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} +``` + +### NotebookWorkspaces_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Get. */ +public final class NotebookWorkspacesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceGet.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().getWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} +``` + +### NotebookWorkspaces_ListByDatabaseAccount + +```java +import com.azure.core.util.Context; + +/** Samples for NotebookWorkspaces ListByDatabaseAccount. */ +public final class NotebookWorkspacesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceList.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} +``` + +### NotebookWorkspaces_ListConnectionInfo + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces ListConnectionInfo. */ +public final class NotebookWorkspacesListConnectionInfoSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceListConnectionInfo. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceListConnectionInfo( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .notebookWorkspaces() + .listConnectionInfoWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} +``` + +### NotebookWorkspaces_RegenerateAuthToken + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces RegenerateAuthToken. */ +public final class NotebookWorkspacesRegenerateAuthTokenSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceRegenerateAuthToken. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceRegenerateAuthToken( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().regenerateAuthToken("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} +``` + +### NotebookWorkspaces_Start + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Start. */ +public final class NotebookWorkspacesStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceStart.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceStart. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceStart( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().start("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBOperationsList.json + */ + /** + * Sample code: CosmosDBOperationsList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBOperationsList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### PartitionKeyRangeId_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeId ListMetrics. */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPKeyRangeIdGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .partitionKeyRangeIds() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} +``` + +### PartitionKeyRangeIdRegion_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeIdRegion ListMetrics. */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .partitionKeyRangeIdRegions() + .listMetrics( + "rg1", + "ddb1", + "West US", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} +``` + +### Percentile_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for Percentile ListMetrics. */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentiles() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### PercentileSourceTarget_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for PercentileSourceTarget ListMetrics. */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileSourceTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentileSourceTargets() + .listMetrics( + "rg1", + "ddb1", + "West Central US", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### PercentileTarget_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for PercentileTarget ListMetrics. */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentileTargets() + .listMetrics( + "rg1", + "ddb1", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .privateEndpointConnections() + .define("privateEndpointConnectionName") + .withExistingDatabaseAccount("rg1", "ddb1") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateEndpointConnections().delete("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByDatabaseAccount + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByDatabaseAccount. */ +public final class PrivateEndpointConnectionsListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateEndpointConnections().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "sql", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByDatabaseAccount + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByDatabaseAccount. */ +public final class PrivateLinkResourcesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateLinkResources().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} +``` + +### ResourceProvider_List + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider List. */ +public final class ResourceProviderListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBLocationList.json + */ + /** + * Sample code: CosmosDBLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.resourceProviders().list(Context.NONE); + } +} +``` + +### ResourceProvider_LocationGet + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider LocationGet. */ +public final class ResourceProviderLocationGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBLocationGet.json + */ + /** + * Sample code: CosmosDBLocationGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.resourceProviders().locationGetWithResponse("westus", Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_GetByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts GetByLocation. */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableDatabaseAccounts() + .getByLocationWithResponse("West US", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts List. */ +public final class RestorableDatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountNoLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountNoLocationList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableDatabaseAccounts().list(Context.NONE); + } +} +``` + +### RestorableDatabaseAccounts_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts ListByLocation. */ +public final class RestorableDatabaseAccountsListByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableDatabaseAccounts().listByLocation("West US", Context.NONE); + } +} +``` + +### RestorableMongodbCollections_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbCollections List. */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbCollectionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbCollectionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableMongodbCollections() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", Context.NONE); + } +} +``` + +### RestorableMongodbDatabases_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbDatabases List. */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbDatabaseList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableMongodbDatabases().list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} +``` + +### RestorableMongodbResources_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbResources List. */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbResourceList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbResourceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableMongodbResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} +``` + +### RestorableSqlContainers_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableSqlContainers List. */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlContainerList.json + */ + /** + * Sample code: CosmosDBRestorableSqlContainerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlContainerList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableSqlContainers() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "3fu-hg==", null, null, Context.NONE); + } +} +``` + +### RestorableSqlDatabases_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableSqlDatabases List. */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlDatabaseList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableSqlDatabases().list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} +``` + +### RestorableSqlResources_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableSqlResources List. */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlResourceList.json + */ + /** + * Sample code: CosmosDBRestorableSqlResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlResourceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableSqlResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} +``` + +### Service_Create + +```java +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +/** Samples for Service Create. */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("SqlDedicatedGateway") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.SQL_DEDICATED_GATEWAY) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceCreate.json + */ + /** + * Sample code: DataTransferServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceCreate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("DataTransfer") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.DATA_TRANSFER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + */ + /** + * Sample code: GraphAPIComputeServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("GraphAPICompute") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.GRAPH_APICOMPUTE) + .create(); + } +} +``` + +### Service_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Service Delete. */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "SqlDedicatedGateway", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceDelete.json + */ + /** + * Sample code: DataTransferServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "DataTransfer", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json + */ + /** + * Sample code: GraphAPIComputeServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "GraphAPICompute", Context.NONE); + } +} +``` + +### Service_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Service Get. */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceGet.json + */ + /** + * Sample code: DataTransferServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "DataTransfer", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + */ + /** + * Sample code: GraphAPIComputeServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "GraphAPICompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "SqlDedicatedGateway", Context.NONE); + } +} +``` + +### Service_List + +```java +import com.azure.core.util.Context; + +/** Samples for Service List. */ +public final class ServiceListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBServicesList.json + */ + /** + * Sample code: CosmosDBServicesList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBServicesList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().list("rg1", "ddb1", Context.NONE); + } +} +``` + +### SqlResources_CreateUpdateSqlContainer + +```java +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.DataType; +import com.azure.resourcemanager.cosmos.generated.models.IncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.IndexKind; +import com.azure.resourcemanager.cosmos.generated.models.Indexes; +import com.azure.resourcemanager.cosmos.generated.models.IndexingMode; +import com.azure.resourcemanager.cosmos.generated.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKind; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKey; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlContainer. */ +public final class SqlResourcesCreateUpdateSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlContainer("containerName") + .withRegion("West US") + .withExistingSqlDatabase("rg1", "ddb1", "databaseName") + .withResource( + new SqlContainerResource() + .withId("containerName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys(Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlResources_CreateUpdateSqlDatabase + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlDatabase. */ +public final class SqlResourcesCreateUpdateSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new SqlDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlResources_CreateUpdateSqlRoleAssignment + +```java +/** Samples for SqlResources CreateUpdateSqlRoleAssignment. */ +public final class SqlResourcesCreateUpdateSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlRoleAssignment("myRoleAssignmentId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleDefinitionId( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId") + .withScope( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases") + .withPrincipalId("myPrincipalId") + .create(); + } +} +``` + +### SqlResources_CreateUpdateSqlRoleDefinition + +```java +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import java.util.Arrays; + +/** Samples for SqlResources CreateUpdateSqlRoleDefinition. */ +public final class SqlResourcesCreateUpdateSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlRoleDefinition("myRoleDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleName("myRoleName") + .withType(RoleDefinitionType.CUSTOM_ROLE) + .withAssignableScopes( + Arrays + .asList( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")) + .withPermissions( + Arrays + .asList( + new Permission() + .withDataActions( + Arrays + .asList( + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create", + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")) + .withNotDataActions(Arrays.asList()))) + .create(); + } +} +``` + +### SqlResources_CreateUpdateSqlStoredProcedure + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; + +/** Samples for SqlResources CreateUpdateSqlStoredProcedure. */ +public final class SqlResourcesCreateUpdateSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlStoredProcedure("storedProcedureName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource(new SqlStoredProcedureResource().withId("storedProcedureName").withBody("body")) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} +``` + +### SqlResources_CreateUpdateSqlTrigger + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import com.azure.resourcemanager.cosmos.generated.models.TriggerOperation; +import com.azure.resourcemanager.cosmos.generated.models.TriggerType; + +/** Samples for SqlResources CreateUpdateSqlTrigger. */ +public final class SqlResourcesCreateUpdateSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlTriggerCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlTrigger("triggerName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource( + new SqlTriggerResource() + .withId("triggerName") + .withBody("body") + .withTriggerType(TriggerType.fromString("triggerType")) + .withTriggerOperation(TriggerOperation.fromString("triggerOperation"))) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} +``` + +### SqlResources_CreateUpdateSqlUserDefinedFunction + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; + +/** Samples for SqlResources CreateUpdateSqlUserDefinedFunction. */ +public final class SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlUserDefinedFunction("userDefinedFunctionName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource(new SqlUserDefinedFunctionResource().withId("userDefinedFunctionName").withBody("body")) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} +``` + +### SqlResources_DeleteSqlContainer + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlContainer. */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerDelete.json + */ + /** + * Sample code: CosmosDBSqlContainerDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().deleteSqlContainer("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlDatabase. */ +public final class SqlResourcesDeleteSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseDelete.json + */ + /** + * Sample code: CosmosDBSqlDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().deleteSqlDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlRoleAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleAssignment. */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlRoleAssignment("myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlRoleDefinition + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleDefinition. */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlRoleDefinition("myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlStoredProcedure + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlStoredProcedure. */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureDelete.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlStoredProcedure( + "rg1", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlTrigger + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlTrigger. */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerDelete.json + */ + /** + * Sample code: CosmosDBSqlTriggerDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlTrigger("rg1", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} +``` + +### SqlResources_DeleteSqlUserDefinedFunction + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlUserDefinedFunction. */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlUserDefinedFunction( + "rg1", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlContainer + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainer. */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerGet.json + */ + /** + * Sample code: CosmosDBSqlContainerGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlContainerWithResponse("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlContainerThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainerThroughput. */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlContainerThroughputWithResponse("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabase. */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().getSqlDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlDatabaseThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabaseThroughput. */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().getSqlDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlRoleAssignment + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleAssignment. */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentGet.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlRoleAssignmentWithResponse( + "myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlRoleDefinition + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleDefinition. */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionGet.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlRoleDefinitionWithResponse( + "myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlStoredProcedure + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlStoredProcedure. */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureGet.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlStoredProcedureWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlTrigger + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlTrigger. */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerGet.json + */ + /** + * Sample code: CosmosDBSqlTriggerGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlTriggerWithResponse("rgName", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} +``` + +### SqlResources_GetSqlUserDefinedFunction + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlUserDefinedFunction. */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlUserDefinedFunctionWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlContainers + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlContainers. */ +public final class SqlResourcesListSqlContainersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerList.json + */ + /** + * Sample code: CosmosDBSqlContainerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlContainers("rgName", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlDatabases + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlDatabases. */ +public final class SqlResourcesListSqlDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlDatabases("rgName", "ddb1", Context.NONE); + } +} +``` + +### SqlResources_ListSqlRoleAssignments + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleAssignments. */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentList.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlRoleAssignments("myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlRoleDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleDefinitions. */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionList.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlRoleDefinitions("myResourceGroupName", "myAccountName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlStoredProcedures + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlStoredProcedures. */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureList.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlStoredProcedures("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlTriggers + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlTriggers. */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerList.json + */ + /** + * Sample code: CosmosDBSqlTriggerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlTriggers("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_ListSqlUserDefinedFunctions + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlUserDefinedFunctions. */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionList.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .listSqlUserDefinedFunctions("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlContainerToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToAutoscale. */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .migrateSqlContainerToAutoscale("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlContainerToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToManualThroughput. */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .migrateSqlContainerToManualThroughput("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlDatabaseToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToAutoscale. */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().migrateSqlDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_MigrateSqlDatabaseToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToManualThroughput. */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().migrateSqlDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} +``` + +### SqlResources_RetrieveContinuousBackupInformation + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** Samples for SqlResources RetrieveContinuousBackupInformation. */ +public final class SqlResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBBackupInformation.json + */ + /** + * Sample code: CosmosDBSqlContainerBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerBackupInformation( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .retrieveContinuousBackupInformation( + "rgName", + "ddb1", + "databaseName", + "containerName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), + Context.NONE); + } +} +``` + +### SqlResources_UpdateSqlContainerThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlContainerThroughput. */ +public final class SqlResourcesUpdateSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .updateSqlContainerThroughput( + "rg1", + "ddb1", + "databaseName", + "containerName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlResources_UpdateSqlDatabaseThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlDatabaseThroughput. */ +public final class SqlResourcesUpdateSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .updateSqlDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### TableResources_CreateUpdateTable + +```java +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources CreateUpdateTable. */ +public final class TableResourcesCreateUpdateTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBTableReplace. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableReplace(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .tableResources() + .define("tableName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new TableResource().withId("tableName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### TableResources_DeleteTable + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources DeleteTable. */ +public final class TableResourcesDeleteTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableDelete.json + */ + /** + * Sample code: CosmosDBTableDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().deleteTable("rg1", "ddb1", "tableName", Context.NONE); + } +} +``` + +### TableResources_GetTable + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources GetTable. */ +public final class TableResourcesGetTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableGet.json + */ + /** + * Sample code: CosmosDBTableGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().getTableWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} +``` + +### TableResources_GetTableThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources GetTableThroughput. */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableThroughputGet.json + */ + /** + * Sample code: CosmosDBTableThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableThroughputGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().getTableThroughputWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} +``` + +### TableResources_ListTables + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources ListTables. */ +public final class TableResourcesListTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableList.json + */ + /** + * Sample code: CosmosDBTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().listTables("rgName", "ddb1", Context.NONE); + } +} +``` + +### TableResources_MigrateTableToAutoscale + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToAutoscale. */ +public final class TableResourcesMigrateTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBTableMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().migrateTableToAutoscale("rg1", "ddb1", "tableName", Context.NONE); + } +} +``` + +### TableResources_MigrateTableToManualThroughput + +```java +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToManualThroughput. */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBTableMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().migrateTableToManualThroughput("rg1", "ddb1", "tableName", Context.NONE); + } +} +``` + +### TableResources_UpdateTableThroughput + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources UpdateTableThroughput. */ +public final class TableResourcesUpdateTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBTableThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .tableResources() + .updateTableThroughput( + "rg1", + "ddb1", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml new file mode 100644 index 0000000000000..28cb2fa8126ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-cosmos-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CosmosDB Management + This package contains Microsoft Azure SDK for CosmosDB Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Cosmos DB Database Service Resource Provider REST API. Package tag package-2021-07-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + false + + + + + + com.azure + azure-core + 1.22.0 + + + com.azure + azure-core-management + 1.4.3 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java new file mode 100644 index 0000000000000..5cda160c8f3e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/CosmosDBManager.java @@ -0,0 +1,638 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CosmosDBManagementClient; +import com.azure.resourcemanager.cosmos.generated.implementation.CassandraClustersImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CassandraDataCentersImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CassandraResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CollectionPartitionRegionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CollectionPartitionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CollectionRegionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CollectionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.CosmosDBManagementClientBuilder; +import com.azure.resourcemanager.cosmos.generated.implementation.DatabaseAccountRegionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.DatabaseAccountsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.DatabasesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.GraphResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.GremlinResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.MongoDBResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.NotebookWorkspacesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PartitionKeyRangeIdRegionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PartitionKeyRangeIdsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PercentileSourceTargetsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PercentileTargetsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PercentilesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableDatabaseAccountsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbCollectionsImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbDatabasesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableMongodbResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlContainersImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlDatabasesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.RestorableSqlResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.ServicesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.SqlResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.implementation.TableResourcesImpl; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraDataCenters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraResources; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitionRegions; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitions; +import com.azure.resourcemanager.cosmos.generated.models.CollectionRegions; +import com.azure.resourcemanager.cosmos.generated.models.Collections; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegions; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccounts; +import com.azure.resourcemanager.cosmos.generated.models.Databases; +import com.azure.resourcemanager.cosmos.generated.models.GraphResources; +import com.azure.resourcemanager.cosmos.generated.models.GremlinResources; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBResources; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaces; +import com.azure.resourcemanager.cosmos.generated.models.Operations; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIdRegions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIds; +import com.azure.resourcemanager.cosmos.generated.models.PercentileSourceTargets; +import com.azure.resourcemanager.cosmos.generated.models.PercentileTargets; +import com.azure.resourcemanager.cosmos.generated.models.Percentiles; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.cosmos.generated.models.ResourceProviders; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccounts; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollections; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabases; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResources; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainers; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabases; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResources; +import com.azure.resourcemanager.cosmos.generated.models.Services; +import com.azure.resourcemanager.cosmos.generated.models.SqlResources; +import com.azure.resourcemanager.cosmos.generated.models.TableResources; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to CosmosDBManager. Azure Cosmos DB Database Service Resource Provider REST API. */ +public final class CosmosDBManager { + private DatabaseAccounts databaseAccounts; + + private Operations operations; + + private Databases databases; + + private Collections collections; + + private CollectionRegions collectionRegions; + + private DatabaseAccountRegions databaseAccountRegions; + + private PercentileSourceTargets percentileSourceTargets; + + private PercentileTargets percentileTargets; + + private Percentiles percentiles; + + private CollectionPartitionRegions collectionPartitionRegions; + + private CollectionPartitions collectionPartitions; + + private PartitionKeyRangeIds partitionKeyRangeIds; + + private PartitionKeyRangeIdRegions partitionKeyRangeIdRegions; + + private GraphResources graphResources; + + private SqlResources sqlResources; + + private MongoDBResources mongoDBResources; + + private TableResources tableResources; + + private CassandraResources cassandraResources; + + private GremlinResources gremlinResources; + + private ResourceProviders resourceProviders; + + private NotebookWorkspaces notebookWorkspaces; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private RestorableDatabaseAccounts restorableDatabaseAccounts; + + private RestorableSqlDatabases restorableSqlDatabases; + + private RestorableSqlContainers restorableSqlContainers; + + private RestorableSqlResources restorableSqlResources; + + private RestorableMongodbDatabases restorableMongodbDatabases; + + private RestorableMongodbCollections restorableMongodbCollections; + + private RestorableMongodbResources restorableMongodbResources; + + private CassandraClusters cassandraClusters; + + private CassandraDataCenters cassandraDataCenters; + + private Services services; + + private final CosmosDBManagementClient clientObject; + + private CosmosDBManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CosmosDBManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CosmosDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CosmosDB service API instance. + */ + public static CosmosDBManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create CosmosDBManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CosmosDBManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of CosmosDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CosmosDB service API instance. + */ + public CosmosDBManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.cosmos.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CosmosDBManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of DatabaseAccounts. */ + public DatabaseAccounts databaseAccounts() { + if (this.databaseAccounts == null) { + this.databaseAccounts = new DatabaseAccountsImpl(clientObject.getDatabaseAccounts(), this); + } + return databaseAccounts; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Databases. */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** @return Resource collection API of Collections. */ + public Collections collections() { + if (this.collections == null) { + this.collections = new CollectionsImpl(clientObject.getCollections(), this); + } + return collections; + } + + /** @return Resource collection API of CollectionRegions. */ + public CollectionRegions collectionRegions() { + if (this.collectionRegions == null) { + this.collectionRegions = new CollectionRegionsImpl(clientObject.getCollectionRegions(), this); + } + return collectionRegions; + } + + /** @return Resource collection API of DatabaseAccountRegions. */ + public DatabaseAccountRegions databaseAccountRegions() { + if (this.databaseAccountRegions == null) { + this.databaseAccountRegions = + new DatabaseAccountRegionsImpl(clientObject.getDatabaseAccountRegions(), this); + } + return databaseAccountRegions; + } + + /** @return Resource collection API of PercentileSourceTargets. */ + public PercentileSourceTargets percentileSourceTargets() { + if (this.percentileSourceTargets == null) { + this.percentileSourceTargets = + new PercentileSourceTargetsImpl(clientObject.getPercentileSourceTargets(), this); + } + return percentileSourceTargets; + } + + /** @return Resource collection API of PercentileTargets. */ + public PercentileTargets percentileTargets() { + if (this.percentileTargets == null) { + this.percentileTargets = new PercentileTargetsImpl(clientObject.getPercentileTargets(), this); + } + return percentileTargets; + } + + /** @return Resource collection API of Percentiles. */ + public Percentiles percentiles() { + if (this.percentiles == null) { + this.percentiles = new PercentilesImpl(clientObject.getPercentiles(), this); + } + return percentiles; + } + + /** @return Resource collection API of CollectionPartitionRegions. */ + public CollectionPartitionRegions collectionPartitionRegions() { + if (this.collectionPartitionRegions == null) { + this.collectionPartitionRegions = + new CollectionPartitionRegionsImpl(clientObject.getCollectionPartitionRegions(), this); + } + return collectionPartitionRegions; + } + + /** @return Resource collection API of CollectionPartitions. */ + public CollectionPartitions collectionPartitions() { + if (this.collectionPartitions == null) { + this.collectionPartitions = new CollectionPartitionsImpl(clientObject.getCollectionPartitions(), this); + } + return collectionPartitions; + } + + /** @return Resource collection API of PartitionKeyRangeIds. */ + public PartitionKeyRangeIds partitionKeyRangeIds() { + if (this.partitionKeyRangeIds == null) { + this.partitionKeyRangeIds = new PartitionKeyRangeIdsImpl(clientObject.getPartitionKeyRangeIds(), this); + } + return partitionKeyRangeIds; + } + + /** @return Resource collection API of PartitionKeyRangeIdRegions. */ + public PartitionKeyRangeIdRegions partitionKeyRangeIdRegions() { + if (this.partitionKeyRangeIdRegions == null) { + this.partitionKeyRangeIdRegions = + new PartitionKeyRangeIdRegionsImpl(clientObject.getPartitionKeyRangeIdRegions(), this); + } + return partitionKeyRangeIdRegions; + } + + /** @return Resource collection API of GraphResources. */ + public GraphResources graphResources() { + if (this.graphResources == null) { + this.graphResources = new GraphResourcesImpl(clientObject.getGraphResources(), this); + } + return graphResources; + } + + /** @return Resource collection API of SqlResources. */ + public SqlResources sqlResources() { + if (this.sqlResources == null) { + this.sqlResources = new SqlResourcesImpl(clientObject.getSqlResources(), this); + } + return sqlResources; + } + + /** @return Resource collection API of MongoDBResources. */ + public MongoDBResources mongoDBResources() { + if (this.mongoDBResources == null) { + this.mongoDBResources = new MongoDBResourcesImpl(clientObject.getMongoDBResources(), this); + } + return mongoDBResources; + } + + /** @return Resource collection API of TableResources. */ + public TableResources tableResources() { + if (this.tableResources == null) { + this.tableResources = new TableResourcesImpl(clientObject.getTableResources(), this); + } + return tableResources; + } + + /** @return Resource collection API of CassandraResources. */ + public CassandraResources cassandraResources() { + if (this.cassandraResources == null) { + this.cassandraResources = new CassandraResourcesImpl(clientObject.getCassandraResources(), this); + } + return cassandraResources; + } + + /** @return Resource collection API of GremlinResources. */ + public GremlinResources gremlinResources() { + if (this.gremlinResources == null) { + this.gremlinResources = new GremlinResourcesImpl(clientObject.getGremlinResources(), this); + } + return gremlinResources; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of NotebookWorkspaces. */ + public NotebookWorkspaces notebookWorkspaces() { + if (this.notebookWorkspaces == null) { + this.notebookWorkspaces = new NotebookWorkspacesImpl(clientObject.getNotebookWorkspaces(), this); + } + return notebookWorkspaces; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of RestorableDatabaseAccounts. */ + public RestorableDatabaseAccounts restorableDatabaseAccounts() { + if (this.restorableDatabaseAccounts == null) { + this.restorableDatabaseAccounts = + new RestorableDatabaseAccountsImpl(clientObject.getRestorableDatabaseAccounts(), this); + } + return restorableDatabaseAccounts; + } + + /** @return Resource collection API of RestorableSqlDatabases. */ + public RestorableSqlDatabases restorableSqlDatabases() { + if (this.restorableSqlDatabases == null) { + this.restorableSqlDatabases = + new RestorableSqlDatabasesImpl(clientObject.getRestorableSqlDatabases(), this); + } + return restorableSqlDatabases; + } + + /** @return Resource collection API of RestorableSqlContainers. */ + public RestorableSqlContainers restorableSqlContainers() { + if (this.restorableSqlContainers == null) { + this.restorableSqlContainers = + new RestorableSqlContainersImpl(clientObject.getRestorableSqlContainers(), this); + } + return restorableSqlContainers; + } + + /** @return Resource collection API of RestorableSqlResources. */ + public RestorableSqlResources restorableSqlResources() { + if (this.restorableSqlResources == null) { + this.restorableSqlResources = + new RestorableSqlResourcesImpl(clientObject.getRestorableSqlResources(), this); + } + return restorableSqlResources; + } + + /** @return Resource collection API of RestorableMongodbDatabases. */ + public RestorableMongodbDatabases restorableMongodbDatabases() { + if (this.restorableMongodbDatabases == null) { + this.restorableMongodbDatabases = + new RestorableMongodbDatabasesImpl(clientObject.getRestorableMongodbDatabases(), this); + } + return restorableMongodbDatabases; + } + + /** @return Resource collection API of RestorableMongodbCollections. */ + public RestorableMongodbCollections restorableMongodbCollections() { + if (this.restorableMongodbCollections == null) { + this.restorableMongodbCollections = + new RestorableMongodbCollectionsImpl(clientObject.getRestorableMongodbCollections(), this); + } + return restorableMongodbCollections; + } + + /** @return Resource collection API of RestorableMongodbResources. */ + public RestorableMongodbResources restorableMongodbResources() { + if (this.restorableMongodbResources == null) { + this.restorableMongodbResources = + new RestorableMongodbResourcesImpl(clientObject.getRestorableMongodbResources(), this); + } + return restorableMongodbResources; + } + + /** @return Resource collection API of CassandraClusters. */ + public CassandraClusters cassandraClusters() { + if (this.cassandraClusters == null) { + this.cassandraClusters = new CassandraClustersImpl(clientObject.getCassandraClusters(), this); + } + return cassandraClusters; + } + + /** @return Resource collection API of CassandraDataCenters. */ + public CassandraDataCenters cassandraDataCenters() { + if (this.cassandraDataCenters == null) { + this.cassandraDataCenters = new CassandraDataCentersImpl(clientObject.getCassandraDataCenters(), this); + } + return cassandraDataCenters; + } + + /** @return Resource collection API of Services. */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** + * @return Wrapped service client CosmosDBManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public CosmosDBManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java new file mode 100644 index 0000000000000..cf006470c8825 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraClustersClient.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; + +/** An instance of this class provides access to all the operations defined in CassandraClustersClient. */ +public interface CassandraClustersClient { + /** + * List all managed Cassandra clusters in this subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all managed Cassandra clusters in this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResourceInner getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, Context context); + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body); + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context); + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResourceInner createUpdate(String resourceGroupName, String clusterName, ClusterResourceInner body); + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResourceInner createUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context); + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body); + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context); + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResourceInner update(String resourceGroupName, String clusterName, ClusterResourceInner body); + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterResourceInner update( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRequestRepair( + String resourceGroupName, String clusterName, RepairPostBody body); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRequestRepair( + String resourceGroupName, String clusterName, RepairPostBody body, Context context); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body, Context context); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterNodeStatusInner> beginFetchNodeStatus( + String resourceGroupName, String clusterName); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterNodeStatusInner> beginFetchNodeStatus( + String resourceGroupName, String clusterName, Context context); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterNodeStatusInner fetchNodeStatus(String resourceGroupName, String clusterName); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterNodeStatusInner fetchNodeStatus(String resourceGroupName, String clusterName, Context context); + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBackups(String resourceGroupName, String clusterName); + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBackups(String resourceGroupName, String clusterName, Context context); + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResourceInner getBackup(String resourceGroupName, String clusterName, String backupId); + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getBackupWithResponse( + String resourceGroupName, String clusterName, String backupId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraDataCentersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraDataCentersClient.java new file mode 100644 index 0000000000000..77479c768924f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraDataCentersClient.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; + +/** An instance of this class provides access to all the operations defined in CassandraDataCentersClient. */ +public interface CassandraDataCentersClient { + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String clusterName); + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String clusterName, Context context); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCenterResourceInner get(String resourceGroupName, String clusterName, String dataCenterName); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String clusterName, String dataCenterName, Context context); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, String dataCenterName); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String dataCenterName, Context context); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String dataCenterName); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterName, String dataCenterName, Context context); + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataCenterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body); + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataCenterResourceInner> beginCreateUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context); + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCenterResourceInner createUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body); + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCenterResourceInner createUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context); + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataCenterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body); + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataCenterResourceInner> beginUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context); + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCenterResourceInner update( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body); + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCenterResourceInner update( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java new file mode 100644 index 0000000000000..3a847731db5cf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CassandraResourcesClient.java @@ -0,0 +1,1434 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in CassandraResourcesClient. */ +public interface CassandraResourcesClient { + /** + * Lists the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName); + + /** + * Lists the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the RUs per second of the Cassandra Keyspace 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the RUs per second of the Cassandra Keyspace 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale(String resourceGroupName, String accountName, String keyspaceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Lists the Cassandra materialized views 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Lists the Cassandra materialized views 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraViewGetResultsInner getCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraViewWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraViewGetResultsInner> beginCreateUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CassandraViewGetResultsInner> beginCreateUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraViewGetResultsInner createUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters); + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CassandraViewGetResultsInner createUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraView(String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getCassandraViewThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getCassandraViewThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.java new file mode 100644 index 0000000000000..71bf720881e09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionRegionsClient. */ +public interface CollectionPartitionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java new file mode 100644 index 0000000000000..2b56234440753 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionPartitionsClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionsClient. */ +public interface CollectionPartitionsClient { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java new file mode 100644 index 0000000000000..b91fa05e2f395 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionRegionsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in CollectionRegionsClient. */ +public interface CollectionRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java new file mode 100644 index 0000000000000..a5c83b2e13f7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CollectionsClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in CollectionsClient. */ +public interface CollectionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java new file mode 100644 index 0000000000000..1558c301245ec --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/CosmosDBManagementClient.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for CosmosDBManagementClient class. */ +public interface CosmosDBManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the DatabaseAccountsClient object to access its operations. + * + * @return the DatabaseAccountsClient object. + */ + DatabaseAccountsClient getDatabaseAccounts(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + + /** + * Gets the CollectionsClient object to access its operations. + * + * @return the CollectionsClient object. + */ + CollectionsClient getCollections(); + + /** + * Gets the CollectionRegionsClient object to access its operations. + * + * @return the CollectionRegionsClient object. + */ + CollectionRegionsClient getCollectionRegions(); + + /** + * Gets the DatabaseAccountRegionsClient object to access its operations. + * + * @return the DatabaseAccountRegionsClient object. + */ + DatabaseAccountRegionsClient getDatabaseAccountRegions(); + + /** + * Gets the PercentileSourceTargetsClient object to access its operations. + * + * @return the PercentileSourceTargetsClient object. + */ + PercentileSourceTargetsClient getPercentileSourceTargets(); + + /** + * Gets the PercentileTargetsClient object to access its operations. + * + * @return the PercentileTargetsClient object. + */ + PercentileTargetsClient getPercentileTargets(); + + /** + * Gets the PercentilesClient object to access its operations. + * + * @return the PercentilesClient object. + */ + PercentilesClient getPercentiles(); + + /** + * Gets the CollectionPartitionRegionsClient object to access its operations. + * + * @return the CollectionPartitionRegionsClient object. + */ + CollectionPartitionRegionsClient getCollectionPartitionRegions(); + + /** + * Gets the CollectionPartitionsClient object to access its operations. + * + * @return the CollectionPartitionsClient object. + */ + CollectionPartitionsClient getCollectionPartitions(); + + /** + * Gets the PartitionKeyRangeIdsClient object to access its operations. + * + * @return the PartitionKeyRangeIdsClient object. + */ + PartitionKeyRangeIdsClient getPartitionKeyRangeIds(); + + /** + * Gets the PartitionKeyRangeIdRegionsClient object to access its operations. + * + * @return the PartitionKeyRangeIdRegionsClient object. + */ + PartitionKeyRangeIdRegionsClient getPartitionKeyRangeIdRegions(); + + /** + * Gets the GraphResourcesClient object to access its operations. + * + * @return the GraphResourcesClient object. + */ + GraphResourcesClient getGraphResources(); + + /** + * Gets the SqlResourcesClient object to access its operations. + * + * @return the SqlResourcesClient object. + */ + SqlResourcesClient getSqlResources(); + + /** + * Gets the MongoDBResourcesClient object to access its operations. + * + * @return the MongoDBResourcesClient object. + */ + MongoDBResourcesClient getMongoDBResources(); + + /** + * Gets the TableResourcesClient object to access its operations. + * + * @return the TableResourcesClient object. + */ + TableResourcesClient getTableResources(); + + /** + * Gets the CassandraResourcesClient object to access its operations. + * + * @return the CassandraResourcesClient object. + */ + CassandraResourcesClient getCassandraResources(); + + /** + * Gets the GremlinResourcesClient object to access its operations. + * + * @return the GremlinResourcesClient object. + */ + GremlinResourcesClient getGremlinResources(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the NotebookWorkspacesClient object to access its operations. + * + * @return the NotebookWorkspacesClient object. + */ + NotebookWorkspacesClient getNotebookWorkspaces(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the RestorableDatabaseAccountsClient object to access its operations. + * + * @return the RestorableDatabaseAccountsClient object. + */ + RestorableDatabaseAccountsClient getRestorableDatabaseAccounts(); + + /** + * Gets the RestorableSqlDatabasesClient object to access its operations. + * + * @return the RestorableSqlDatabasesClient object. + */ + RestorableSqlDatabasesClient getRestorableSqlDatabases(); + + /** + * Gets the RestorableSqlContainersClient object to access its operations. + * + * @return the RestorableSqlContainersClient object. + */ + RestorableSqlContainersClient getRestorableSqlContainers(); + + /** + * Gets the RestorableSqlResourcesClient object to access its operations. + * + * @return the RestorableSqlResourcesClient object. + */ + RestorableSqlResourcesClient getRestorableSqlResources(); + + /** + * Gets the RestorableMongodbDatabasesClient object to access its operations. + * + * @return the RestorableMongodbDatabasesClient object. + */ + RestorableMongodbDatabasesClient getRestorableMongodbDatabases(); + + /** + * Gets the RestorableMongodbCollectionsClient object to access its operations. + * + * @return the RestorableMongodbCollectionsClient object. + */ + RestorableMongodbCollectionsClient getRestorableMongodbCollections(); + + /** + * Gets the RestorableMongodbResourcesClient object to access its operations. + * + * @return the RestorableMongodbResourcesClient object. + */ + RestorableMongodbResourcesClient getRestorableMongodbResources(); + + /** + * Gets the CassandraClustersClient object to access its operations. + * + * @return the CassandraClustersClient object. + */ + CassandraClustersClient getCassandraClusters(); + + /** + * Gets the CassandraDataCentersClient object to access its operations. + * + * @return the CassandraDataCentersClient object. + */ + CassandraDataCentersClient getCassandraDataCenters(); + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + ServicesClient getServices(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java new file mode 100644 index 0000000000000..527626327ad66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountRegionsClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountRegionsClient. */ +public interface DatabaseAccountRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String region, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java new file mode 100644 index 0000000000000..9e5315b45273c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabaseAccountsClient.java @@ -0,0 +1,782 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountsClient. */ +public interface DatabaseAccountsClient { + /** + * Retrieves the properties of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieves the properties of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters); + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context); + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner update( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters); + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner update( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters); + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName); + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, Context context); + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failoverPriorityChange(String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName); + + /** + * Lists the access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the connection strings for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName); + + /** + * Lists the connection strings for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void onlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + boolean checkNameExists(String accountName); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameExistsWithResponse(String accountName, Context context); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java new file mode 100644 index 0000000000000..df5a79b206d25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/DatabasesClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GraphResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GraphResourcesClient.java new file mode 100644 index 0000000000000..8e1830db3be34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GraphResourcesClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceCreateUpdateParameters; + +/** An instance of this class provides access to all the operations defined in GraphResourcesClient. */ +public interface GraphResourcesClient { + /** + * Lists the graphs 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGraphs(String resourceGroupName, String accountName); + + /** + * Lists the graphs 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGraphs( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GraphResourceGetResultsInner getGraph(String resourceGroupName, String accountName, String graphName); + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGraphWithResponse( + String resourceGroupName, String accountName, String graphName, Context context); + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GraphResourceGetResultsInner> beginCreateUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters); + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GraphResourceGetResultsInner> beginCreateUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GraphResourceGetResultsInner createUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters); + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GraphResourceGetResultsInner createUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGraphResource( + String resourceGroupName, String accountName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGraphResource( + String resourceGroupName, String accountName, String graphName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGraphResource(String resourceGroupName, String accountName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGraphResource(String resourceGroupName, String accountName, String graphName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java new file mode 100644 index 0000000000000..c50aeb465de97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/GremlinResourcesClient.java @@ -0,0 +1,943 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in GremlinResourcesClient. */ +public interface GremlinResourcesClient { + /** + * Lists the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinDatabases(String resourceGroupName, String accountName); + + /** + * Lists the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the Gremlin database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the Gremlin database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GremlinGraphGetResultsInner> beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GremlinGraphGetResultsInner> beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java new file mode 100644 index 0000000000000..c28f2b5ef1f99 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/MongoDBResourcesClient.java @@ -0,0 +1,954 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in MongoDBResourcesClient. */ +public interface MongoDBResourcesClient { + /** + * Lists the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName); + + /** + * Lists the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters); + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the MongoDB database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the MongoDB database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java new file mode 100644 index 0000000000000..4124c2709312a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/NotebookWorkspacesClient.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** An instance of this class provides access to all the operations defined in NotebookWorkspacesClient. */ +public interface NotebookWorkspacesClient { + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters); + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotebookWorkspaceConnectionInfoResultInner listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..f8018e4162588 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java new file mode 100644 index 0000000000000..58b422f3e7ee8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdRegionsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdRegionsClient. */ +public interface PartitionKeyRangeIdRegionsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java new file mode 100644 index 0000000000000..23d5345a64cf6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PartitionKeyRangeIdsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdsClient. */ +public interface PartitionKeyRangeIdsClient { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java new file mode 100644 index 0000000000000..6a70d24b6dc7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileSourceTargetsClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileSourceTargetsClient. */ +public interface PercentileSourceTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java new file mode 100644 index 0000000000000..4ada663aeb2e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentileTargetsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentileTargetsClient. */ +public interface PercentileTargetsClient { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java new file mode 100644 index 0000000000000..7217806035694 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PercentilesClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; + +/** An instance of this class provides access to all the operations defined in PercentilesClient. */ +public interface PercentilesClient { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..40020eb35833c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..19d4b673e55a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String accountName, String groupName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ResourceProvidersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..6e8415e905bad --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ResourceProvidersClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * List Cosmos DB locations and their properties. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Cosmos DB locations and their properties. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationGetResultInner locationGet(String location); + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response locationGetWithResponse(String location, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java new file mode 100644 index 0000000000000..e1a81199344c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableDatabaseAccountsClient.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableDatabaseAccountsClient. */ +public interface RestorableDatabaseAccountsClient { + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDatabaseAccountGetResultInner getByLocation(String location, String instanceId); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByLocationWithResponse( + String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java new file mode 100644 index 0000000000000..9d78a201e544d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbCollectionsClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbCollectionsClient. */ +public interface RestorableMongodbCollectionsClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java new file mode 100644 index 0000000000000..b7afb413fcaac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbDatabasesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbDatabasesClient. */ +public interface RestorableMongodbDatabasesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java new file mode 100644 index 0000000000000..500f18611ecbe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableMongodbResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbResourcesClient. */ +public interface RestorableMongodbResourcesClient { + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java new file mode 100644 index 0000000000000..0ff310ccfaf9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlContainersClient.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlContainersClient. */ +public interface RestorableSqlContainersClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java new file mode 100644 index 0000000000000..900814ff66fac --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlDatabasesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlDatabasesClient. */ +public interface RestorableSqlDatabasesClient { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java new file mode 100644 index 0000000000000..d7584af724787 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/RestorableSqlResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; + +/** An instance of this class provides access to all the operations defined in RestorableSqlResourcesClient. */ +public interface RestorableSqlResourcesClient { + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ServicesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ServicesClient.java new file mode 100644 index 0000000000000..a75ed09ec23f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/ServicesClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceCreateUpdateParameters; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public interface ServicesClient { + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName, Context context); + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServiceResourceInner> beginCreate( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters); + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServiceResourceInner> beginCreate( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner create( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters); + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner create( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner get(String resourceGroupName, String accountName, String serviceName); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String serviceName, Context context); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, String serviceName); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String serviceName, Context context); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String serviceName); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String serviceName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java new file mode 100644 index 0000000000000..d66ee7c18a380 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/SqlResourcesClient.java @@ -0,0 +1,2210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in SqlResourcesClient. */ +public interface SqlResourcesClient { + /** + * Lists the SQL databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlDatabases(String resourceGroupName, String accountName); + + /** + * Lists the SQL databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner getSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters); + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlContainerGetResultsInner> beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlContainerGetResultsInner> beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Lists the SQL storedProcedure 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL storedProcedure 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters); + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Lists the SQL userDefinedFunction 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL userDefinedFunction 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters); + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Lists the SQL trigger 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL trigger 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters); + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters); + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupInformationInner> beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java new file mode 100644 index 0000000000000..bc83860d66dff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/TableResourcesClient.java @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; + +/** An instance of this class provides access to all the operations defined in TableResourcesClient. */ +public interface TableResourcesClient { + /** + * Lists the Tables 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTables(String resourceGroupName, String accountName); + + /** + * Lists the Tables 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listTables(String resourceGroupName, String accountName, Context context); + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner getTable(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters); + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteTable(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner getTableThroughput( + String resourceGroupName, String accountName, String tableName); + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java new file mode 100644 index 0000000000000..19775273edb83 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupInformationInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Backup information of a resource. */ +@Immutable +public final class BackupInformationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupInformationInner.class); + + /* + * Information about the status of continuous backups. + */ + @JsonProperty(value = "continuousBackupInformation", access = JsonProperty.Access.WRITE_ONLY) + private ContinuousBackupInformation continuousBackupInformation; + + /** + * Get the continuousBackupInformation property: Information about the status of continuous backups. + * + * @return the continuousBackupInformation value. + */ + public ContinuousBackupInformation continuousBackupInformation() { + return this.continuousBackupInformation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (continuousBackupInformation() != null) { + continuousBackupInformation().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupResourceInner.java new file mode 100644 index 0000000000000..e659717b5666a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/BackupResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.BackupResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A restorable backup of a Cassandra cluster. */ +@Fluent +public final class BackupResourceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupResourceInner.class); + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private BackupResourceProperties properties; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public BackupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the BackupResourceInner object itself. + */ + public BackupResourceInner withProperties(BackupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.java new file mode 100644 index 0000000000000..0377e660b152e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceCreateUpdateProperties.class); + + /* + * The standard JSON format of a Cassandra keyspace + */ + @JsonProperty(value = "resource", required = true) + private CassandraKeyspaceResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Cassandra keyspace. + * + * @return the resource value. + */ + public CassandraKeyspaceResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceCreateUpdateProperties object itself. + */ + public CassandraKeyspaceCreateUpdateProperties withResource(CassandraKeyspaceResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraKeyspaceCreateUpdateProperties object itself. + */ + public CassandraKeyspaceCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model CassandraKeyspaceCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetProperties.java new file mode 100644 index 0000000000000..739efb12bbfae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private CassandraKeyspaceGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private CassandraKeyspaceGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraKeyspaceGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceGetProperties object itself. + */ + public CassandraKeyspaceGetProperties withResource(CassandraKeyspaceGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraKeyspaceGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraKeyspaceGetProperties object itself. + */ + public CassandraKeyspaceGetProperties withOptions(CassandraKeyspaceGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.java new file mode 100644 index 0000000000000..75f7963f38b38 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraKeyspaceGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Cassandra keyspace + */ + @JsonProperty(value = "properties") + private CassandraKeyspaceGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Cassandra keyspace. + * + * @return the innerProperties value. + */ + private CassandraKeyspaceGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraKeyspaceGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withResource(CassandraKeyspaceGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraKeyspaceGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withOptions(CassandraKeyspaceGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.java new file mode 100644 index 0000000000000..f9ba9bb18ceba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableCreateUpdateProperties.class); + + /* + * The standard JSON format of a Cassandra table + */ + @JsonProperty(value = "resource", required = true) + private CassandraTableResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Cassandra table. + * + * @return the resource value. + */ + public CassandraTableResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Cassandra table. + * + * @param resource the resource value to set. + * @return the CassandraTableCreateUpdateProperties object itself. + */ + public CassandraTableCreateUpdateProperties withResource(CassandraTableResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraTableCreateUpdateProperties object itself. + */ + public CassandraTableCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model CassandraTableCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetProperties.java new file mode 100644 index 0000000000000..6f8eb95fe4987 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private CassandraTableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private CassandraTableGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraTableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraTableGetProperties object itself. + */ + public CassandraTableGetProperties withResource(CassandraTableGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraTableGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraTableGetProperties object itself. + */ + public CassandraTableGetProperties withOptions(CassandraTableGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.java new file mode 100644 index 0000000000000..aaa03d9230a56 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraTableGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Cassandra table + */ + @JsonProperty(value = "properties") + private CassandraTableGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Cassandra table. + * + * @return the innerProperties value. + */ + private CassandraTableGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraTableGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withResource(CassandraTableGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraTableGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withOptions(CassandraTableGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewCreateUpdateProperties.java new file mode 100644 index 0000000000000..b66a912f374fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Cassandra view. */ +@Fluent +public final class CassandraViewCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewCreateUpdateProperties.class); + + /* + * The standard JSON format of a Cassandra view + */ + @JsonProperty(value = "resource", required = true) + private CassandraViewResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Cassandra view. + * + * @return the resource value. + */ + public CassandraViewResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Cassandra view. + * + * @param resource the resource value to set. + * @return the CassandraViewCreateUpdateProperties object itself. + */ + public CassandraViewCreateUpdateProperties withResource(CassandraViewResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraViewCreateUpdateProperties object itself. + */ + public CassandraViewCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model CassandraViewCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetProperties.java new file mode 100644 index 0000000000000..8f41977bdb4fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Cassandra view. */ +@Fluent +public final class CassandraViewGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private CassandraViewGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private CassandraViewGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraViewGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraViewGetProperties object itself. + */ + public CassandraViewGetProperties withResource(CassandraViewGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraViewGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraViewGetProperties object itself. + */ + public CassandraViewGetProperties withOptions(CassandraViewGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetResultsInner.java new file mode 100644 index 0000000000000..7d4948125934d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/CassandraViewGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Cassandra view. */ +@Fluent +public final class CassandraViewGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Cassandra view + */ + @JsonProperty(value = "properties") + private CassandraViewGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Cassandra view. + * + * @return the innerProperties value. + */ + private CassandraViewGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public CassandraViewGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the CassandraViewGetResultsInner object itself. + */ + public CassandraViewGetResultsInner withResource(CassandraViewGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraViewGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public CassandraViewGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the CassandraViewGetResultsInner object itself. + */ + public CassandraViewGetResultsInner withOptions(CassandraViewGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraViewGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterNodeStatusInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterNodeStatusInner.java new file mode 100644 index 0000000000000..941db0e70e072 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterNodeStatusInner.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ClusterNodeStatusNodesItem; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The status of all nodes in the cluster (as returned by 'nodetool status'). */ +@Fluent +public final class ClusterNodeStatusInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterNodeStatusInner.class); + + /* + * Information about nodes in the cluster (corresponds to what is returned + * from nodetool info). + */ + @JsonProperty(value = "nodes") + private List nodes; + + /** + * Get the nodes property: Information about nodes in the cluster (corresponds to what is returned from nodetool + * info). + * + * @return the nodes value. + */ + public List nodes() { + return this.nodes; + } + + /** + * Set the nodes property: Information about nodes in the cluster (corresponds to what is returned from nodetool + * info). + * + * @param nodes the nodes value to set. + * @return the ClusterNodeStatusInner object itself. + */ + public ClusterNodeStatusInner withNodes(List nodes) { + this.nodes = nodes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nodes() != null) { + nodes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterResourceInner.java new file mode 100644 index 0000000000000..7a26ec4632dc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ClusterResourceInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Representation of a managed Cassandra cluster. */ +@Fluent +public final class ClusterResourceInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterResourceInner.class); + + /* + * Properties of a managed Cassandra cluster. + */ + @JsonProperty(value = "properties") + private ClusterResourceProperties properties; + + /** + * Get the properties property: Properties of a managed Cassandra cluster. + * + * @return the properties value. + */ + public ClusterResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of a managed Cassandra cluster. + * + * @param properties the properties value to set. + * @return the ClusterResourceInner object itself. + */ + public ClusterResourceInner withProperties(ClusterResourceProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterResourceInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DataCenterResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DataCenterResourceInner.java new file mode 100644 index 0000000000000..1b73ddc348b66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DataCenterResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed Cassandra data center. */ +@Fluent +public final class DataCenterResourceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCenterResourceInner.class); + + /* + * Properties of a managed Cassandra data center. + */ + @JsonProperty(value = "properties") + private DataCenterResourceProperties properties; + + /** + * Get the properties property: Properties of a managed Cassandra data center. + * + * @return the properties value. + */ + public DataCenterResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of a managed Cassandra data center. + * + * @param properties the properties value to set. + * @return the DataCenterResourceInner object itself. + */ + public DataCenterResourceInner withProperties(DataCenterResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java new file mode 100644 index 0000000000000..828f5b356d9fe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountCreateUpdateProperties.java @@ -0,0 +1,829 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties to create and update Azure Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountCreateUpdateProperties.class); + + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the + * Cosmos DB account. + */ + @JsonProperty(value = "locations", required = true) + private List locations; + + /* + * The offer type for the database + */ + @JsonProperty(value = "databaseAccountOfferType", required = true) + private String databaseAccountOfferType = "Standard"; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like + * customer managed keys. The default identity needs to be explicitly set + * by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" + * and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "createMode", required = true) + private CreateMode createMode; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + */ + @JsonProperty(value = "diagnosticLogSettings") + private DiagnosticLogSettings diagnosticLogSettings; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "restoreParameters") + private RestoreParameters restoreParameters; + + /** Creates an instance of DatabaseAccountCreateUpdateProperties class. */ + public DatabaseAccountCreateUpdateProperties() { + databaseAccountOfferType = "Standard"; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @param locations the locations value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the databaseAccountOfferType property: The offer type for the database. + * + * @return the databaseAccountOfferType value. + */ + public String databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Set the databaseAccountOfferType property: The offer type for the database. + * + * @param databaseAccountOfferType the databaseAccountOfferType value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDatabaseAccountOfferType(String databaseAccountOfferType) { + this.databaseAccountOfferType = databaseAccountOfferType; + return this; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withIsVirtualNetworkFilterEnabled( + Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableMultipleWriteLocations( + Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.defaultIdentity; + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDefaultIdentity(String defaultIdentity) { + this.defaultIdentity = defaultIdentity; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.enableFreeTier; + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableFreeTier(Boolean enableFreeTier) { + this.enableFreeTier = enableFreeTier; + return this; + } + + /** + * Get the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withApiProperties(ApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.enableAnalyticalStorage; + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + this.enableAnalyticalStorage = enableAnalyticalStorage; + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.analyticalStorageConfiguration; + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + this.analyticalStorageConfiguration = analyticalStorageConfiguration; + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of account creation. + * + * @param createMode the createMode value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.cors; + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withCors(List cors) { + this.cors = cors; + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.networkAclBypass; + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + this.networkAclBypass = networkAclBypass; + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.networkAclBypassResourceIds; + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withNetworkAclBypassResourceIds( + List networkAclBypassResourceIds) { + this.networkAclBypassResourceIds = networkAclBypassResourceIds; + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.diagnosticLogSettings; + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDiagnosticLogSettings( + DiagnosticLogSettings diagnosticLogSettings) { + this.diagnosticLogSettings = diagnosticLogSettings; + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public RestoreParameters restoreParameters() { + return this.restoreParameters; + } + + /** + * Set the restoreParameters property: Parameters to indicate the information about the restore. + * + * @param restoreParameters the restoreParameters value to set. + * @return the DatabaseAccountCreateUpdateProperties object itself. + */ + public DatabaseAccountCreateUpdateProperties withRestoreParameters(RestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (locations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property locations in model DatabaseAccountCreateUpdateProperties")); + } else { + locations().forEach(e -> e.validate()); + } + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + if (analyticalStorageConfiguration() != null) { + analyticalStorageConfiguration().validate(); + } + if (createMode() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property createMode in model DatabaseAccountCreateUpdateProperties")); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (cors() != null) { + cors().forEach(e -> e.validate()); + } + if (diagnosticLogSettings() != null) { + diagnosticLogSettings().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetProperties.java new file mode 100644 index 0000000000000..c5d71b3d47146 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetProperties.java @@ -0,0 +1,922 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for the database account. */ +@Fluent +public final class DatabaseAccountGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountGetProperties.class); + + /* + * The status of the Cosmos DB account at the time the operation was + * called. The status can be one of following. 'Creating' – the Cosmos DB + * account is being created. When an account is in Creating state, only + * properties that are specified as input for the Create Cosmos DB account + * operation are returned. 'Succeeded' – the Cosmos DB account is active + * for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' + * – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB + * account failed creation. 'DeletionFailed' – the Cosmos DB account + * deletion failed. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The connection endpoint for the Cosmos DB database account. + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The offer type for the Cosmos DB database account. Default value: + * Standard. + */ + @JsonProperty(value = "databaseAccountOfferType", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountOfferType databaseAccountOfferType; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * The consistency policy for the Cosmos DB database account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * An array that contains the write location for the Cosmos DB account. + */ + @JsonProperty(value = "writeLocations", access = JsonProperty.Access.WRITE_ONLY) + private List writeLocations; + + /* + * An array that contains of the read locations enabled for the Cosmos DB + * account. + */ + @JsonProperty(value = "readLocations", access = JsonProperty.Access.WRITE_ONLY) + private List readLocations; + + /* + * An array that contains all of the locations enabled for the Cosmos DB + * account. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * An array that contains the regions ordered by their failover priorities. + */ + @JsonProperty(value = "failoverPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List failoverPolicies; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * List of Private Endpoint Connections configured for the Cosmos DB + * account. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like + * customer managed keys. The default identity needs to be explicitly set + * by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" + * and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * A unique identifier assigned to the database account + */ + @JsonProperty(value = "instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * Enum to indicate the mode of account creation. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * Parameters to indicate the information about the restore. + */ + @JsonProperty(value = "restoreParameters") + private RestoreParameters restoreParameters; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + */ + @JsonProperty(value = "diagnosticLogSettings") + private DiagnosticLogSettings diagnosticLogSettings; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /** + * Get the provisioningState property: The status of the Cosmos DB account at the time the operation was called. The + * status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in + * Creating state, only properties that are specified as input for the Create Cosmos DB account operation are + * returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being + * updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. + * 'DeletionFailed' – the Cosmos DB account deletion failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the documentEndpoint property: The connection endpoint for the Cosmos DB database account. + * + * @return the documentEndpoint value. + */ + public String documentEndpoint() { + return this.documentEndpoint; + } + + /** + * Get the databaseAccountOfferType property: The offer type for the Cosmos DB database account. Default value: + * Standard. + * + * @return the databaseAccountOfferType value. + */ + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB database account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB database account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the writeLocations property: An array that contains the write location for the Cosmos DB account. + * + * @return the writeLocations value. + */ + public List writeLocations() { + return this.writeLocations; + } + + /** + * Get the readLocations property: An array that contains of the read locations enabled for the Cosmos DB account. + * + * @return the readLocations value. + */ + public List readLocations() { + return this.readLocations; + } + + /** + * Get the locations property: An array that contains all of the locations enabled for the Cosmos DB account. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the failoverPolicies property: An array that contains the regions ordered by their failover priorities. + * + * @return the failoverPolicies value. + */ + public List failoverPolicies() { + return this.failoverPolicies; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get the privateEndpointConnections property: List of Private Endpoint Connections configured for the Cosmos DB + * account. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.defaultIdentity; + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withDefaultIdentity(String defaultIdentity) { + this.defaultIdentity = defaultIdentity; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.enableFreeTier; + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableFreeTier(Boolean enableFreeTier) { + this.enableFreeTier = enableFreeTier; + return this; + } + + /** + * Get the apiProperties property: API specific properties. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the apiProperties property: API specific properties. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withApiProperties(ApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.enableAnalyticalStorage; + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + this.enableAnalyticalStorage = enableAnalyticalStorage; + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.analyticalStorageConfiguration; + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + this.analyticalStorageConfiguration = analyticalStorageConfiguration; + return this; + } + + /** + * Get the instanceId property: A unique identifier assigned to the database account. + * + * @return the instanceId value. + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Enum to indicate the mode of account creation. + * + * @param createMode the createMode value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public RestoreParameters restoreParameters() { + return this.restoreParameters; + } + + /** + * Set the restoreParameters property: Parameters to indicate the information about the restore. + * + * @param restoreParameters the restoreParameters value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withRestoreParameters(RestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.cors; + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withCors(List cors) { + this.cors = cors; + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.networkAclBypass; + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + this.networkAclBypass = networkAclBypass; + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.networkAclBypassResourceIds; + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withNetworkAclBypassResourceIds(List networkAclBypassResourceIds) { + this.networkAclBypassResourceIds = networkAclBypassResourceIds; + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.diagnosticLogSettings; + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings) { + this.diagnosticLogSettings = diagnosticLogSettings; + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountGetProperties object itself. + */ + public DatabaseAccountGetProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (writeLocations() != null) { + writeLocations().forEach(e -> e.validate()); + } + if (readLocations() != null) { + readLocations().forEach(e -> e.validate()); + } + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (failoverPolicies() != null) { + failoverPolicies().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + if (analyticalStorageConfiguration() != null) { + analyticalStorageConfiguration().validate(); + } + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (cors() != null) { + cors().forEach(e -> e.validate()); + } + if (diagnosticLogSettings() != null) { + diagnosticLogSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java new file mode 100644 index 0000000000000..481fbf95a656c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountGetResultsInner.java @@ -0,0 +1,813 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure Cosmos DB database account. */ +@Fluent +public final class DatabaseAccountGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountGetResultsInner.class); + + /* + * Indicates the type of database account. This can only be set at database + * account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Properties for the database account. + */ + @JsonProperty(value = "properties") + private DatabaseAccountGetProperties innerProperties; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the kind property: Indicates the type of database account. This can only be set at database account creation. + * + * @return the kind value. + */ + public DatabaseAccountKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the type of database account. This can only be set at database account creation. + * + * @param kind the kind value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withKind(DatabaseAccountKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the innerProperties property: Properties for the database account. + * + * @return the innerProperties value. + */ + private DatabaseAccountGetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The status of the Cosmos DB account at the time the operation was called. The + * status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in + * Creating state, only properties that are specified as input for the Create Cosmos DB account operation are + * returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being + * updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. + * 'DeletionFailed' – the Cosmos DB account deletion failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the documentEndpoint property: The connection endpoint for the Cosmos DB database account. + * + * @return the documentEndpoint value. + */ + public String documentEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().documentEndpoint(); + } + + /** + * Get the databaseAccountOfferType property: The offer type for the Cosmos DB database account. Default value: + * Standard. + * + * @return the databaseAccountOfferType value. + */ + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.innerProperties() == null ? null : this.innerProperties().databaseAccountOfferType(); + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.innerProperties() == null ? null : this.innerProperties().ipRules(); + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withIpRules(List ipRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withIpRules(ipRules); + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isVirtualNetworkFilterEnabled(); + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticFailover(); + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB database account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().consistencyPolicy(); + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB database account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withConsistencyPolicy(consistencyPolicy); + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.innerProperties() == null ? null : this.innerProperties().capabilities(); + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withCapabilities(List capabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withCapabilities(capabilities); + return this; + } + + /** + * Get the writeLocations property: An array that contains the write location for the Cosmos DB account. + * + * @return the writeLocations value. + */ + public List writeLocations() { + return this.innerProperties() == null ? null : this.innerProperties().writeLocations(); + } + + /** + * Get the readLocations property: An array that contains of the read locations enabled for the Cosmos DB account. + * + * @return the readLocations value. + */ + public List readLocations() { + return this.innerProperties() == null ? null : this.innerProperties().readLocations(); + } + + /** + * Get the locations property: An array that contains all of the locations enabled for the Cosmos DB account. + * + * @return the locations value. + */ + public List locations() { + return this.innerProperties() == null ? null : this.innerProperties().locations(); + } + + /** + * Get the failoverPolicies property: An array that contains the regions ordered by their failover priorities. + * + * @return the failoverPolicies value. + */ + public List failoverPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().failoverPolicies(); + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkRules(); + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withVirtualNetworkRules(List virtualNetworkRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withVirtualNetworkRules(virtualNetworkRules); + return this; + } + + /** + * Get the privateEndpointConnections property: List of Private Endpoint Connections configured for the Cosmos DB + * account. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.innerProperties() == null ? null : this.innerProperties().enableMultipleWriteLocations(); + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableMultipleWriteLocations(enableMultipleWriteLocations); + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.innerProperties() == null ? null : this.innerProperties().enableCassandraConnector(); + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableCassandraConnector(Boolean enableCassandraConnector) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableCassandraConnector(enableCassandraConnector); + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.innerProperties() == null ? null : this.innerProperties().connectorOffer(); + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withConnectorOffer(ConnectorOffer connectorOffer) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withConnectorOffer(connectorOffer); + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.innerProperties() == null ? null : this.innerProperties().disableKeyBasedMetadataWriteAccess(); + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.innerProperties() == null ? null : this.innerProperties().keyVaultKeyUri(); + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withKeyVaultKeyUri(String keyVaultKeyUri) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withKeyVaultKeyUri(keyVaultKeyUri); + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().defaultIdentity(); + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDefaultIdentity(String defaultIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withDefaultIdentity(defaultIdentity); + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.innerProperties() == null ? null : this.innerProperties().enableFreeTier(); + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableFreeTier(Boolean enableFreeTier) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableFreeTier(enableFreeTier); + return this; + } + + /** + * Get the apiProperties property: API specific properties. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.innerProperties() == null ? null : this.innerProperties().apiProperties(); + } + + /** + * Set the apiProperties property: API specific properties. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withApiProperties(ApiProperties apiProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withApiProperties(apiProperties); + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.innerProperties() == null ? null : this.innerProperties().enableAnalyticalStorage(); + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withEnableAnalyticalStorage(enableAnalyticalStorage); + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().analyticalStorageConfiguration(); + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withAnalyticalStorageConfiguration(analyticalStorageConfiguration); + return this; + } + + /** + * Get the instanceId property: A unique identifier assigned to the database account. + * + * @return the instanceId value. + */ + public String instanceId() { + return this.innerProperties() == null ? null : this.innerProperties().instanceId(); + } + + /** + * Get the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: Enum to indicate the mode of account creation. + * + * @param createMode the createMode value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public RestoreParameters restoreParameters() { + return this.innerProperties() == null ? null : this.innerProperties().restoreParameters(); + } + + /** + * Set the restoreParameters property: Parameters to indicate the information about the restore. + * + * @param restoreParameters the restoreParameters value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withRestoreParameters(RestoreParameters restoreParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withRestoreParameters(restoreParameters); + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().backupPolicy(); + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withBackupPolicy(BackupPolicy backupPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withBackupPolicy(backupPolicy); + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.innerProperties() == null ? null : this.innerProperties().cors(); + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withCors(List cors) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withCors(cors); + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypass(); + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withNetworkAclBypass(networkAclBypass); + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypassResourceIds(); + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withNetworkAclBypassResourceIds(List networkAclBypassResourceIds) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withNetworkAclBypassResourceIds(networkAclBypassResourceIds); + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticLogSettings(); + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withDiagnosticLogSettings(diagnosticLogSettings); + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountGetProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..853872708750a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListConnectionStringsResultInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The connection strings for the given database account. */ +@Fluent +public final class DatabaseAccountListConnectionStringsResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DatabaseAccountListConnectionStringsResultInner.class); + + /* + * An array that contains the connection strings for the Cosmos DB account. + */ + @JsonProperty(value = "connectionStrings") + private List connectionStrings; + + /** + * Get the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value. + */ + public List connectionStrings() { + return this.connectionStrings; + } + + /** + * Set the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @param connectionStrings the connectionStrings value to set. + * @return the DatabaseAccountListConnectionStringsResultInner object itself. + */ + public DatabaseAccountListConnectionStringsResultInner withConnectionStrings( + List connectionStrings) { + this.connectionStrings = connectionStrings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionStrings() != null) { + connectionStrings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java new file mode 100644 index 0000000000000..c2dc41808d004 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The access keys for the given database account. */ +@Immutable +public final class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountListKeysResultInner.class); + + /* + * Base 64 encoded value of the primary read-write key. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryMasterKey; + + /* + * Base 64 encoded value of the secondary read-write key. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryMasterKey; + + /** + * Get the primaryMasterKey property: Base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value. + */ + public String primaryMasterKey() { + return this.primaryMasterKey; + } + + /** + * Get the secondaryMasterKey property: Base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value. + */ + public String secondaryMasterKey() { + return this.secondaryMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java new file mode 100644 index 0000000000000..f65ed483bcfff --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountListReadOnlyKeysResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The read-only access keys for the given database account. */ +@Immutable +public class DatabaseAccountListReadOnlyKeysResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountListReadOnlyKeysResultInner.class); + + /* + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /* + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** + * Get the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java new file mode 100644 index 0000000000000..7da457e159361 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseAccountUpdateProperties.java @@ -0,0 +1,726 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties to update Azure Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountUpdateProperties.class); + + /* + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /* + * An array that contains the georeplication locations enabled for the + * Cosmos DB account. + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * List of IpRules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /* + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /* + * List of Cosmos DB capabilities for the account + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /* + * Enables the account to write in multiple locations + */ + @JsonProperty(value = "enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /* + * Enables the cassandra connector on the Cosmos DB C* account + */ + @JsonProperty(value = "enableCassandraConnector") + private Boolean enableCassandraConnector; + + /* + * The cassandra connector offer type for the Cosmos DB database C* + * account. + */ + @JsonProperty(value = "connectorOffer") + private ConnectorOffer connectorOffer; + + /* + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys + */ + @JsonProperty(value = "disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /* + * The URI of the key vault + */ + @JsonProperty(value = "keyVaultKeyUri") + private String keyVaultKeyUri; + + /* + * The default identity for accessing key vault used in features like + * customer managed keys. The default identity needs to be explicitly set + * by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" + * and more. + */ + @JsonProperty(value = "defaultIdentity") + private String defaultIdentity; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Flag to indicate whether Free Tier is enabled. + */ + @JsonProperty(value = "enableFreeTier") + private Boolean enableFreeTier; + + /* + * API specific properties. Currently, supported only for MongoDB API. + */ + @JsonProperty(value = "apiProperties") + private ApiProperties apiProperties; + + /* + * Flag to indicate whether to enable storage analytics. + */ + @JsonProperty(value = "enableAnalyticalStorage") + private Boolean enableAnalyticalStorage; + + /* + * Analytical storage specific properties. + */ + @JsonProperty(value = "analyticalStorageConfiguration") + private AnalyticalStorageConfiguration analyticalStorageConfiguration; + + /* + * The object representing the policy for taking backups on an account. + */ + @JsonProperty(value = "backupPolicy") + private BackupPolicy backupPolicy; + + /* + * The CORS policy for the Cosmos DB database account. + */ + @JsonProperty(value = "cors") + private List cors; + + /* + * Indicates what services are allowed to bypass firewall checks. + */ + @JsonProperty(value = "networkAclBypass") + private NetworkAclBypass networkAclBypass; + + /* + * An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + */ + @JsonProperty(value = "networkAclBypassResourceIds") + private List networkAclBypassResourceIds; + + /* + * The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + */ + @JsonProperty(value = "diagnosticLogSettings") + private DiagnosticLogSettings diagnosticLogSettings; + + /* + * Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @param locations the locations value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.defaultIdentity; + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withDefaultIdentity(String defaultIdentity) { + this.defaultIdentity = defaultIdentity; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.enableFreeTier; + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableFreeTier(Boolean enableFreeTier) { + this.enableFreeTier = enableFreeTier; + return this; + } + + /** + * Get the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withApiProperties(ApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.enableAnalyticalStorage; + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + this.enableAnalyticalStorage = enableAnalyticalStorage; + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.analyticalStorageConfiguration; + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + this.analyticalStorageConfiguration = analyticalStorageConfiguration; + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.cors; + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withCors(List cors) { + this.cors = cors; + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.networkAclBypass; + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + this.networkAclBypass = networkAclBypass; + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.networkAclBypassResourceIds; + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withNetworkAclBypassResourceIds(List networkAclBypassResourceIds) { + this.networkAclBypassResourceIds = networkAclBypassResourceIds; + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.diagnosticLogSettings; + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings) { + this.diagnosticLogSettings = diagnosticLogSettings; + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountUpdateProperties object itself. + */ + public DatabaseAccountUpdateProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (consistencyPolicy() != null) { + consistencyPolicy().validate(); + } + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + if (analyticalStorageConfiguration() != null) { + analyticalStorageConfiguration().validate(); + } + if (backupPolicy() != null) { + backupPolicy().validate(); + } + if (cors() != null) { + cors().forEach(e -> e.validate()); + } + if (diagnosticLogSettings() != null) { + diagnosticLogSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java new file mode 100644 index 0000000000000..273c9373b100e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/DatabaseRestoreResourceInner.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specific Databases to restore. */ +@Fluent +public final class DatabaseRestoreResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseRestoreResourceInner.class); + + /* + * The name of the database available for restore. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * The names of the collections available for restore. + */ + @JsonProperty(value = "collectionNames") + private List collectionNames; + + /** + * Get the databaseName property: The name of the database available for restore. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: The name of the database available for restore. + * + * @param databaseName the databaseName value to set. + * @return the DatabaseRestoreResourceInner object itself. + */ + public DatabaseRestoreResourceInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the collectionNames property: The names of the collections available for restore. + * + * @return the collectionNames value. + */ + public List collectionNames() { + return this.collectionNames; + } + + /** + * Set the collectionNames property: The names of the collections available for restore. + * + * @param collectionNames the collectionNames value to set. + * @return the DatabaseRestoreResourceInner object itself. + */ + public DatabaseRestoreResourceInner withCollectionNames(List collectionNames) { + this.collectionNames = collectionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..7bd46e50e3b5e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Graph resource. */ +@Fluent +public final class GraphResourceCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceCreateUpdateProperties.class); + + /* + * The standard JSON format of a Graph resource + */ + @JsonProperty(value = "resource", required = true) + private GraphResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Graph resource. + * + * @return the resource value. + */ + public GraphResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Graph resource. + * + * @param resource the resource value to set. + * @return the GraphResourceCreateUpdateProperties object itself. + */ + public GraphResourceCreateUpdateProperties withResource(GraphResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GraphResourceCreateUpdateProperties object itself. + */ + public GraphResourceCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model GraphResourceCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetProperties.java new file mode 100644 index 0000000000000..fef47d4e636c4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database. */ +@Fluent +public final class GraphResourceGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private GraphResourceGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private GraphResourceGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GraphResourceGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GraphResourceGetProperties object itself. + */ + public GraphResourceGetProperties withResource(GraphResourceGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GraphResourceGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GraphResourceGetProperties object itself. + */ + public GraphResourceGetProperties withOptions(GraphResourceGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetResultsInner.java new file mode 100644 index 0000000000000..3f814abcffcd5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GraphResourceGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Graph resource. */ +@Fluent +public final class GraphResourceGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Graph resource. + */ + @JsonProperty(value = "properties") + private GraphResourceGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Graph resource. + * + * @return the innerProperties value. + */ + private GraphResourceGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GraphResourceGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GraphResourceGetResultsInner object itself. + */ + public GraphResourceGetResultsInner withResource(GraphResourceGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GraphResourceGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GraphResourceGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GraphResourceGetResultsInner object itself. + */ + public GraphResourceGetResultsInner withOptions(GraphResourceGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GraphResourceGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseCreateUpdateProperties.java new file mode 100644 index 0000000000000..411a89629dab2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Gremlin database. */ +@Fluent +public final class GremlinDatabaseCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseCreateUpdateProperties.class); + + /* + * The standard JSON format of a Gremlin database + */ + @JsonProperty(value = "resource", required = true) + private GremlinDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Gremlin database. + * + * @return the resource value. + */ + public GremlinDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Gremlin database. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseCreateUpdateProperties object itself. + */ + public GremlinDatabaseCreateUpdateProperties withResource(GremlinDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinDatabaseCreateUpdateProperties object itself. + */ + public GremlinDatabaseCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model GremlinDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetProperties.java new file mode 100644 index 0000000000000..0229272c11703 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database. */ +@Fluent +public final class GremlinDatabaseGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private GremlinDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private GremlinDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseGetProperties object itself. + */ + public GremlinDatabaseGetProperties withResource(GremlinDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinDatabaseGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinDatabaseGetProperties object itself. + */ + public GremlinDatabaseGetProperties withOptions(GremlinDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..1d8c0b5250047 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinDatabaseGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Gremlin database. */ +@Fluent +public final class GremlinDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB SQL database + */ + @JsonProperty(value = "properties") + private GremlinDatabaseGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private GremlinDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withResource(GremlinDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withOptions(GremlinDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.java new file mode 100644 index 0000000000000..493934e3a55ef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphCreateUpdateProperties.class); + + /* + * The standard JSON format of a Gremlin graph + */ + @JsonProperty(value = "resource", required = true) + private GremlinGraphResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Gremlin graph. + * + * @return the resource value. + */ + public GremlinGraphResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource the resource value to set. + * @return the GremlinGraphCreateUpdateProperties object itself. + */ + public GremlinGraphCreateUpdateProperties withResource(GremlinGraphResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinGraphCreateUpdateProperties object itself. + */ + public GremlinGraphCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model GremlinGraphCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetProperties.java new file mode 100644 index 0000000000000..41a7575fc61d1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private GremlinGraphGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private GremlinGraphGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinGraphGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinGraphGetProperties object itself. + */ + public GremlinGraphGetProperties withResource(GremlinGraphGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinGraphGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinGraphGetProperties object itself. + */ + public GremlinGraphGetProperties withOptions(GremlinGraphGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java new file mode 100644 index 0000000000000..4accff026b921 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/GremlinGraphGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Gremlin graph + */ + @JsonProperty(value = "properties") + private GremlinGraphGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Gremlin graph. + * + * @return the innerProperties value. + */ + private GremlinGraphGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public GremlinGraphGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withResource(GremlinGraphGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public GremlinGraphGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withOptions(GremlinGraphGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java new file mode 100644 index 0000000000000..a51a70be45f27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/LocationGetResultInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.LocationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB location get result. */ +@Fluent +public final class LocationGetResultInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationGetResultInner.class); + + /* + * Cosmos DB location metadata + */ + @JsonProperty(value = "properties") + private LocationProperties properties; + + /** + * Get the properties property: Cosmos DB location metadata. + * + * @return the properties value. + */ + public LocationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Cosmos DB location metadata. + * + * @param properties the properties value to set. + * @return the LocationGetResultInner object itself. + */ + public LocationGetResultInner withProperties(LocationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..2810b36183b68 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricAvailability; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The definition of a metric. */ +@Immutable +public final class MetricDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionInner.class); + + /* + * The list of metric availabilities for the account. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /* + * The primary aggregation type of the metric. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * Get the metricAvailabilities property: The list of metric availabilities for the account. + * + * @return the metricAvailabilities value. + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Get the primaryAggregationType property: The primary aggregation type of the metric. + * + * @return the primaryAggregationType value. + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricAvailabilities() != null) { + metricAvailabilities().forEach(e -> e.validate()); + } + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java new file mode 100644 index 0000000000000..6925f3968c08a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Metric data. */ +@Immutable +public class MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricInner.class); + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.java new file mode 100644 index 0000000000000..3761562d7429c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionCreateUpdateProperties.class); + + /* + * The standard JSON format of a MongoDB collection + */ + @JsonProperty(value = "resource", required = true) + private MongoDBCollectionResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a MongoDB collection. + * + * @return the resource value. + */ + public MongoDBCollectionResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionCreateUpdateProperties object itself. + */ + public MongoDBCollectionCreateUpdateProperties withResource(MongoDBCollectionResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBCollectionCreateUpdateProperties object itself. + */ + public MongoDBCollectionCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model MongoDBCollectionCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetProperties.java new file mode 100644 index 0000000000000..a907baa633e20 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private MongoDBCollectionGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private MongoDBCollectionGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBCollectionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionGetProperties object itself. + */ + public MongoDBCollectionGetProperties withResource(MongoDBCollectionGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBCollectionGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBCollectionGetProperties object itself. + */ + public MongoDBCollectionGetProperties withOptions(MongoDBCollectionGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.java new file mode 100644 index 0000000000000..8e08f4766d231 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBCollectionGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB MongoDB collection + */ + @JsonProperty(value = "properties") + private MongoDBCollectionGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB MongoDB collection. + * + * @return the innerProperties value. + */ + private MongoDBCollectionGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBCollectionGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withResource(MongoDBCollectionGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBCollectionGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withOptions(MongoDBCollectionGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.java new file mode 100644 index 0000000000000..aa438ae0fdcb1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseCreateUpdateProperties.class); + + /* + * The standard JSON format of a MongoDB database + */ + @JsonProperty(value = "resource", required = true) + private MongoDBDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a MongoDB database. + * + * @return the resource value. + */ + public MongoDBDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a MongoDB database. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseCreateUpdateProperties object itself. + */ + public MongoDBDatabaseCreateUpdateProperties withResource(MongoDBDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBDatabaseCreateUpdateProperties object itself. + */ + public MongoDBDatabaseCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model MongoDBDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetProperties.java new file mode 100644 index 0000000000000..ee9f4bf0ee9e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private MongoDBDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private MongoDBDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseGetProperties object itself. + */ + public MongoDBDatabaseGetProperties withResource(MongoDBDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBDatabaseGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBDatabaseGetProperties object itself. + */ + public MongoDBDatabaseGetProperties withOptions(MongoDBDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..fb4a44743f480 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/MongoDBDatabaseGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB MongoDB database + */ + @JsonProperty(value = "properties") + private MongoDBDatabaseGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB MongoDB database. + * + * @return the innerProperties value. + */ + private MongoDBDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public MongoDBDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withResource(MongoDBDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public MongoDBDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withOptions(MongoDBDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java new file mode 100644 index 0000000000000..227e967d846bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceConnectionInfoResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The connection info for the given notebook workspace. */ +@Immutable +public final class NotebookWorkspaceConnectionInfoResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceConnectionInfoResultInner.class); + + /* + * Specifies auth token used for connecting to Notebook server (uses + * token-based auth). + */ + @JsonProperty(value = "authToken", access = JsonProperty.Access.WRITE_ONLY) + private String authToken; + + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /** + * Get the authToken property: Specifies auth token used for connecting to Notebook server (uses token-based auth). + * + * @return the authToken value. + */ + public String authToken() { + return this.authToken; + } + + /** + * Get the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.notebookServerEndpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java new file mode 100644 index 0000000000000..50132392b3f42 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceInner.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A notebook workspace resource. */ +@Fluent +public final class NotebookWorkspaceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private NotebookWorkspaceProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private NotebookWorkspaceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().notebookServerEndpoint(); + } + + /** + * Get the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java new file mode 100644 index 0000000000000..345bd20d0e64c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/NotebookWorkspaceProperties.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceProperties.class); + + /* + * Specifies the endpoint of Notebook server. + */ + @JsonProperty(value = "notebookServerEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String notebookServerEndpoint; + + /* + * Status of the notebook workspace. Possible values are: Creating, Online, + * Deleting, Failed, Updating. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + public String notebookServerEndpoint() { + return this.notebookServerEndpoint; + } + + /** + * Get the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..cab13ebb9565c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java new file mode 100644 index 0000000000000..ab67ade34ed7b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionMetricInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metric values for a single partition. */ +@Immutable +public final class PartitionMetricInner extends MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionMetricInner.class); + + /* + * The partition id (GUID identifier) of the metric values. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the metric values. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId property: The partition id (GUID identifier) of the metric values. + * + * @return the partitionId value. + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId property: The partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value. + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java new file mode 100644 index 0000000000000..148057d26c762 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PartitionUsageInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The partition level usage data for a usage request. */ +@Immutable +public final class PartitionUsageInner extends UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionUsageInner.class); + + /* + * The partition id (GUID identifier) of the usages. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /* + * The partition key range id (integer identifier) of the usages. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId property: The partition id (GUID identifier) of the usages. + * + * @return the partitionId value. + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId property: The partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value. + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java new file mode 100644 index 0000000000000..450b61b5bc849 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PercentileMetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Percentile Metric data. */ +@Immutable +public final class PercentileMetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricInner.class); + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The percentile metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The percentile metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..c914e94769ec3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the groupId property: Group id of the private endpoint. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Set the groupId property: Group id of the private endpoint. + * + * @param groupId the groupId value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withGroupId(String groupId) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withGroupId(groupId); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: Provisioning state of the private endpoint. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProvisioningState(String provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..2b355ee50306f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * Group id of the private endpoint. + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * Provisioning state of the private endpoint. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the groupId property: Group id of the private endpoint. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: Group id of the private endpoint. + * + * @param groupId the groupId value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of the private endpoint. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..33a2a0d644d9a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResourceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..6c060fbf573e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource required zone names. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.java new file mode 100644 index 0000000000000..e27350c65e96f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountGetResultInner.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A Azure Cosmos DB restorable database account. */ +@Fluent +public final class RestorableDatabaseAccountGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountGetResultInner.class); + + /* + * The properties of a restorable database account. + */ + @JsonProperty(value = "properties") + private RestorableDatabaseAccountProperties innerProperties; + + /* + * The unique resource identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the innerProperties property: The properties of a restorable database account. + * + * @return the innerProperties value. + */ + private RestorableDatabaseAccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The unique resource identifier of the ARM resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the ARM resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of Azure resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: The location of the resource group to which the resource belongs. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource group to which the resource belongs. + * + * @param location the location value to set. + * @return the RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the accountName property: The name of the global database account. + * + * @return the accountName value. + */ + public String accountName() { + return this.innerProperties() == null ? null : this.innerProperties().accountName(); + } + + /** + * Set the accountName property: The name of the global database account. + * + * @param accountName the accountName value to set. + * @return the RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withAccountName(String accountName) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableDatabaseAccountProperties(); + } + this.innerProperties().withAccountName(accountName); + return this; + } + + /** + * Get the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Set the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @param creationTime the creationTime value to set. + * @return the RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withCreationTime(OffsetDateTime creationTime) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableDatabaseAccountProperties(); + } + this.innerProperties().withCreationTime(creationTime); + return this; + } + + /** + * Get the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().deletionTime(); + } + + /** + * Set the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @param deletionTime the deletionTime value to set. + * @return the RestorableDatabaseAccountGetResultInner object itself. + */ + public RestorableDatabaseAccountGetResultInner withDeletionTime(OffsetDateTime deletionTime) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableDatabaseAccountProperties(); + } + this.innerProperties().withDeletionTime(deletionTime); + return this; + } + + /** + * Get the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + public ApiType apiType() { + return this.innerProperties() == null ? null : this.innerProperties().apiType(); + } + + /** + * Get the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + public List restorableLocations() { + return this.innerProperties() == null ? null : this.innerProperties().restorableLocations(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java new file mode 100644 index 0000000000000..817d0dc01230a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableDatabaseAccountProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of a restorable database account. */ +@Fluent +public final class RestorableDatabaseAccountProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountProperties.class); + + /* + * The name of the global database account + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * The creation time of the restorable database account (ISO-8601 format). + */ + @JsonProperty(value = "creationTime") + private OffsetDateTime creationTime; + + /* + * The time at which the restorable database account has been deleted + * (ISO-8601 format). + */ + @JsonProperty(value = "deletionTime") + private OffsetDateTime deletionTime; + + /* + * The API type of the restorable database account. + */ + @JsonProperty(value = "apiType", access = JsonProperty.Access.WRITE_ONLY) + private ApiType apiType; + + /* + * List of regions where the of the database account can be restored from. + */ + @JsonProperty(value = "restorableLocations", access = JsonProperty.Access.WRITE_ONLY) + private List restorableLocations; + + /** + * Get the accountName property: The name of the global database account. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: The name of the global database account. + * + * @param accountName the accountName value to set. + * @return the RestorableDatabaseAccountProperties object itself. + */ + public RestorableDatabaseAccountProperties withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Set the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @param creationTime the creationTime value to set. + * @return the RestorableDatabaseAccountProperties object itself. + */ + public RestorableDatabaseAccountProperties withCreationTime(OffsetDateTime creationTime) { + this.creationTime = creationTime; + return this; + } + + /** + * Get the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.deletionTime; + } + + /** + * Set the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @param deletionTime the deletionTime value to set. + * @return the RestorableDatabaseAccountProperties object itself. + */ + public RestorableDatabaseAccountProperties withDeletionTime(OffsetDateTime deletionTime) { + this.deletionTime = deletionTime; + return this; + } + + /** + * Get the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Get the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + public List restorableLocations() { + return this.restorableLocations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorableLocations() != null) { + restorableLocations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java new file mode 100644 index 0000000000000..4c38fb4919ea5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionGetResultInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB collection event. */ +@Fluent +public final class RestorableMongodbCollectionGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionGetResultInner.class); + + /* + * The properties of a MongoDB collection event. + */ + @JsonProperty(value = "properties") + private RestorableMongodbCollectionProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the innerProperties property: The properties of a MongoDB collection event. + * + * @return the innerProperties value. + */ + private RestorableMongodbCollectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the ARM resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of Azure resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @return the resource value. + */ + public RestorableMongodbCollectionPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @param resource the resource value to set. + * @return the RestorableMongodbCollectionGetResultInner object itself. + */ + public RestorableMongodbCollectionGetResultInner withResource( + RestorableMongodbCollectionPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableMongodbCollectionProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionProperties.java new file mode 100644 index 0000000000000..b41c8e232f800 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbCollectionProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB collection event. */ +@Fluent +public final class RestorableMongodbCollectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionProperties.class); + + /* + * The resource of an Azure Cosmos DB MongoDB collection event + */ + @JsonProperty(value = "resource") + private RestorableMongodbCollectionPropertiesResource resource; + + /** + * Get the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @return the resource value. + */ + public RestorableMongodbCollectionPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @param resource the resource value to set. + * @return the RestorableMongodbCollectionProperties object itself. + */ + public RestorableMongodbCollectionProperties withResource(RestorableMongodbCollectionPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java new file mode 100644 index 0000000000000..335e9c0cbd9d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB MongoDB database event. */ +@Fluent +public final class RestorableMongodbDatabaseGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabaseGetResultInner.class); + + /* + * The properties of a MongoDB database event. + */ + @JsonProperty(value = "properties") + private RestorableMongodbDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the innerProperties property: The properties of a MongoDB database event. + * + * @return the innerProperties value. + */ + private RestorableMongodbDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the ARM resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of Azure resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @return the resource value. + */ + public RestorableMongodbDatabasePropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @param resource the resource value to set. + * @return the RestorableMongodbDatabaseGetResultInner object itself. + */ + public RestorableMongodbDatabaseGetResultInner withResource(RestorableMongodbDatabasePropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableMongodbDatabaseProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseProperties.java new file mode 100644 index 0000000000000..753f1a6975bde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableMongodbDatabaseProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB MongoDB database event. */ +@Fluent +public final class RestorableMongodbDatabaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabaseProperties.class); + + /* + * The resource of an Azure Cosmos DB MongoDB database event + */ + @JsonProperty(value = "resource") + private RestorableMongodbDatabasePropertiesResource resource; + + /** + * Get the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @return the resource value. + */ + public RestorableMongodbDatabasePropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @param resource the resource value to set. + * @return the RestorableMongodbDatabaseProperties object itself. + */ + public RestorableMongodbDatabaseProperties withResource(RestorableMongodbDatabasePropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java new file mode 100644 index 0000000000000..8f5e6a2dcf6f3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainerGetResultInner.class); + + /* + * The properties of a SQL container event. + */ + @JsonProperty(value = "properties") + private RestorableSqlContainerProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the innerProperties property: The properties of a SQL container event. + * + * @return the innerProperties value. + */ + private RestorableSqlContainerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the ARM resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of Azure resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @return the resource value. + */ + public RestorableSqlContainerPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @param resource the resource value to set. + * @return the RestorableSqlContainerGetResultInner object itself. + */ + public RestorableSqlContainerGetResultInner withResource(RestorableSqlContainerPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableSqlContainerProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerProperties.java new file mode 100644 index 0000000000000..9fe5ecd635e22 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlContainerProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainerProperties.class); + + /* + * The resource of an Azure Cosmos DB SQL container event + */ + @JsonProperty(value = "resource") + private RestorableSqlContainerPropertiesResource resource; + + /** + * Get the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @return the resource value. + */ + public RestorableSqlContainerPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @param resource the resource value to set. + * @return the RestorableSqlContainerProperties object itself. + */ + public RestorableSqlContainerProperties withResource(RestorableSqlContainerPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java new file mode 100644 index 0000000000000..b84ad2910b1f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseGetResultInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabaseGetResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabaseGetResultInner.class); + + /* + * The properties of a SQL database event. + */ + @JsonProperty(value = "properties") + private RestorableSqlDatabaseProperties innerProperties; + + /* + * The unique resource Identifier of the ARM resource. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the ARM resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of Azure resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the innerProperties property: The properties of a SQL database event. + * + * @return the innerProperties value. + */ + private RestorableSqlDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the ARM resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of Azure resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @return the resource value. + */ + public RestorableSqlDatabasePropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @param resource the resource value to set. + * @return the RestorableSqlDatabaseGetResultInner object itself. + */ + public RestorableSqlDatabaseGetResultInner withResource(RestorableSqlDatabasePropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorableSqlDatabaseProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseProperties.java new file mode 100644 index 0000000000000..9fb05795eafe0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/RestorableSqlDatabaseProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabaseProperties.class); + + /* + * The resource of an Azure Cosmos DB SQL database event + */ + @JsonProperty(value = "resource") + private RestorableSqlDatabasePropertiesResource resource; + + /** + * Get the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @return the resource value. + */ + public RestorableSqlDatabasePropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @param resource the resource value to set. + * @return the RestorableSqlDatabaseProperties object itself. + */ + public RestorableSqlDatabaseProperties withResource(RestorableSqlDatabasePropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java new file mode 100644 index 0000000000000..c1ad600188f82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceCreateUpdateProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties in ServiceResourceCreateUpdateParameters. */ +@Fluent +public final class ServiceResourceCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceCreateUpdateProperties.class); + + /* + * Instance type for the service. + */ + @JsonProperty(value = "instanceSize") + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /* + * ServiceType for the service. + */ + @JsonProperty(value = "serviceType") + private ServiceType serviceType; + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.instanceSize; + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withInstanceSize(ServiceSize instanceSize) { + this.instanceSize = instanceSize; + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: ServiceType for the service. + * + * @param serviceType the serviceType value to set. + * @return the ServiceResourceCreateUpdateProperties object itself. + */ + public ServiceResourceCreateUpdateProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java new file mode 100644 index 0000000000000..8347860967115 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ServiceResourceInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for the database account. */ +@Fluent +public final class ServiceResourceInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceInner.class); + + /* + * Services response resource. + */ + @JsonProperty(value = "properties") + private ServiceResourceProperties properties; + + /** + * Get the properties property: Services response resource. + * + * @return the properties value. + */ + public ServiceResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Services response resource. + * + * @param properties the properties value to set. + * @return the ServiceResourceInner object itself. + */ + public ServiceResourceInner withProperties(ServiceResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.java new file mode 100644 index 0000000000000..575f6c58969f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerCreateUpdateProperties.class); + + /* + * The standard JSON format of a container + */ + @JsonProperty(value = "resource", required = true) + private SqlContainerResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a container. + * + * @return the resource value. + */ + public SqlContainerResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a container. + * + * @param resource the resource value to set. + * @return the SqlContainerCreateUpdateProperties object itself. + */ + public SqlContainerCreateUpdateProperties withResource(SqlContainerResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlContainerCreateUpdateProperties object itself. + */ + public SqlContainerCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlContainerCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetProperties.java new file mode 100644 index 0000000000000..eb515524131dd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlContainerGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private SqlContainerGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlContainerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlContainerGetProperties object itself. + */ + public SqlContainerGetProperties withResource(SqlContainerGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlContainerGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlContainerGetProperties object itself. + */ + public SqlContainerGetProperties withOptions(SqlContainerGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java new file mode 100644 index 0000000000000..c94a0c851d2d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlContainerGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB container. */ +@Fluent +public final class SqlContainerGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB container + */ + @JsonProperty(value = "properties") + private SqlContainerGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB container. + * + * @return the innerProperties value. + */ + private SqlContainerGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlContainerGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withResource(SqlContainerGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlContainerGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withOptions(SqlContainerGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.java new file mode 100644 index 0000000000000..ed7293aebf64b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseCreateUpdateProperties.class); + + /* + * The standard JSON format of a SQL database + */ + @JsonProperty(value = "resource", required = true) + private SqlDatabaseResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a SQL database. + * + * @return the resource value. + */ + public SqlDatabaseResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a SQL database. + * + * @param resource the resource value to set. + * @return the SqlDatabaseCreateUpdateProperties object itself. + */ + public SqlDatabaseCreateUpdateProperties withResource(SqlDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlDatabaseCreateUpdateProperties object itself. + */ + public SqlDatabaseCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlDatabaseCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetProperties.java new file mode 100644 index 0000000000000..d1984cca25d87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlDatabaseGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private SqlDatabaseGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlDatabaseGetProperties object itself. + */ + public SqlDatabaseGetProperties withResource(SqlDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlDatabaseGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlDatabaseGetProperties object itself. + */ + public SqlDatabaseGetProperties withOptions(SqlDatabaseGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..6ca73eb7a55d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlDatabaseGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB SQL database + */ + @JsonProperty(value = "properties") + private SqlDatabaseGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private SqlDatabaseGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlDatabaseGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withResource(SqlDatabaseGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public SqlDatabaseGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withOptions(SqlDatabaseGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java new file mode 100644 index 0000000000000..6b8c92138e215 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentGetResultsInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure Cosmos DB Role Assignment. */ +@Fluent +public final class SqlRoleAssignmentGetResultsInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentGetResultsInner.class); + + /* + * Properties related to the Role Assignment. + */ + @JsonProperty(value = "properties") + private SqlRoleAssignmentResource innerProperties; + + /** + * Get the innerProperties property: Properties related to the Role Assignment. + * + * @return the innerProperties value. + */ + private SqlRoleAssignmentResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().roleDefinitionId(); + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withRoleDefinitionId(String roleDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withRoleDefinitionId(roleDefinitionId); + return this; + } + + /** + * Get the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @param scope the scope value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Set the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @param principalId the principalId value to set. + * @return the SqlRoleAssignmentGetResultsInner object itself. + */ + public SqlRoleAssignmentGetResultsInner withPrincipalId(String principalId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withPrincipalId(principalId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java new file mode 100644 index 0000000000000..4e9f1a5c76afa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleAssignmentResource.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Cosmos DB SQL Role Assignment resource object. */ +@Fluent +public final class SqlRoleAssignmentResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentResource.class); + + /* + * The unique identifier for the associated Role Definition. + */ + @JsonProperty(value = "roleDefinitionId") + private String roleDefinitionId; + + /* + * The data plane resource path for which access is being granted through + * this Role Assignment. + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * The unique identifier for the associated AAD principal in the AAD graph + * to which access is being granted through this Role Assignment. Tenant ID + * for the principal is inferred using the tenant associated with the + * subscription. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * Get the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentResource object itself. + */ + public SqlRoleAssignmentResource withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @param scope the scope value to set. + * @return the SqlRoleAssignmentResource object itself. + */ + public SqlRoleAssignmentResource withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @param principalId the principalId value to set. + * @return the SqlRoleAssignmentResource object itself. + */ + public SqlRoleAssignmentResource withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java new file mode 100644 index 0000000000000..29ae93439c50e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionGetResultsInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmProxyResource; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure Cosmos DB SQL Role Definition. */ +@Fluent +public final class SqlRoleDefinitionGetResultsInner extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionGetResultsInner.class); + + /* + * Properties related to the Role Definition. + */ + @JsonProperty(value = "properties") + private SqlRoleDefinitionResource innerProperties; + + /** + * Get the innerProperties property: Properties related to the Role Definition. + * + * @return the innerProperties value. + */ + private SqlRoleDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.innerProperties() == null ? null : this.innerProperties().roleName(); + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withRoleName(String roleName) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withRoleName(roleName); + return this; + } + + /** + * Get the type property: Indicates whether the Role Definition was built-in or user created. + * + * @return the type value. + */ + public RoleDefinitionType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Indicates whether the Role Definition was built-in or user created. + * + * @param type the type value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withTypePropertiesType(RoleDefinitionType type) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + public List assignableScopes() { + return this.innerProperties() == null ? null : this.innerProperties().assignableScopes(); + } + + /** + * Set the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @param assignableScopes the assignableScopes value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withAssignableScopes(List assignableScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withAssignableScopes(assignableScopes); + return this; + } + + /** + * Get the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + public List permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The set of operations allowed through this Role Definition. + * + * @param permissions the permissions value to set. + * @return the SqlRoleDefinitionGetResultsInner object itself. + */ + public SqlRoleDefinitionGetResultsInner withPermissions(List permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java new file mode 100644 index 0000000000000..4b7dfcd3712e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlRoleDefinitionResource.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure Cosmos DB SQL Role Definition resource object. */ +@Fluent +public final class SqlRoleDefinitionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionResource.class); + + /* + * A user-friendly name for the Role Definition. Must be unique for the + * database account. + */ + @JsonProperty(value = "roleName") + private String roleName; + + /* + * Indicates whether the Role Definition was built-in or user created. + */ + @JsonProperty(value = "type") + private RoleDefinitionType type; + + /* + * A set of fully qualified Scopes at or below which Role Assignments may + * be created using this Role Definition. This will allow application of + * this Role Definition on the entire database account or any underlying + * Database / Collection. Must have at least one element. Scopes higher + * than Database account are not enforceable as assignable Scopes. Note + * that resources referenced in assignable Scopes need not exist. + */ + @JsonProperty(value = "assignableScopes") + private List assignableScopes; + + /* + * The set of operations allowed through this Role Definition. + */ + @JsonProperty(value = "permissions") + private List permissions; + + /** + * Get the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.roleName; + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionResource object itself. + */ + public SqlRoleDefinitionResource withRoleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get the type property: Indicates whether the Role Definition was built-in or user created. + * + * @return the type value. + */ + public RoleDefinitionType type() { + return this.type; + } + + /** + * Set the type property: Indicates whether the Role Definition was built-in or user created. + * + * @param type the type value to set. + * @return the SqlRoleDefinitionResource object itself. + */ + public SqlRoleDefinitionResource withType(RoleDefinitionType type) { + this.type = type; + return this; + } + + /** + * Get the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + public List assignableScopes() { + return this.assignableScopes; + } + + /** + * Set the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @param assignableScopes the assignableScopes value to set. + * @return the SqlRoleDefinitionResource object itself. + */ + public SqlRoleDefinitionResource withAssignableScopes(List assignableScopes) { + this.assignableScopes = assignableScopes; + return this; + } + + /** + * Get the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + public List permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The set of operations allowed through this Role Definition. + * + * @param permissions the permissions value to set. + * @return the SqlRoleDefinitionResource object itself. + */ + public SqlRoleDefinitionResource withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissions() != null) { + permissions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureCreateUpdateProperties.java new file mode 100644 index 0000000000000..2b79fb5ec72fe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB storedProcedure. */ +@Fluent +public final class SqlStoredProcedureCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureCreateUpdateProperties.class); + + /* + * The standard JSON format of a storedProcedure + */ + @JsonProperty(value = "resource", required = true) + private SqlStoredProcedureResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a storedProcedure. + * + * @return the resource value. + */ + public SqlStoredProcedureResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a storedProcedure. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureCreateUpdateProperties object itself. + */ + public SqlStoredProcedureCreateUpdateProperties withResource(SqlStoredProcedureResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlStoredProcedureCreateUpdateProperties object itself. + */ + public SqlStoredProcedureCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlStoredProcedureCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetProperties.java new file mode 100644 index 0000000000000..a959073493466 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB StoredProcedure. */ +@Fluent +public final class SqlStoredProcedureGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlStoredProcedureGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlStoredProcedureGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureGetProperties object itself. + */ + public SqlStoredProcedureGetProperties withResource(SqlStoredProcedureGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java new file mode 100644 index 0000000000000..1f5437796e1db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlStoredProcedureGetResultsInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB storedProcedure. */ +@Fluent +public final class SqlStoredProcedureGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB storedProcedure + */ + @JsonProperty(value = "properties") + private SqlStoredProcedureGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB storedProcedure. + * + * @return the innerProperties value. + */ + private SqlStoredProcedureGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlStoredProcedureGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureGetResultsInner object itself. + */ + public SqlStoredProcedureGetResultsInner withResource(SqlStoredProcedureGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.java new file mode 100644 index 0000000000000..92db2bef89160 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerCreateUpdateProperties.class); + + /* + * The standard JSON format of a trigger + */ + @JsonProperty(value = "resource", required = true) + private SqlTriggerResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a trigger. + * + * @return the resource value. + */ + public SqlTriggerResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a trigger. + * + * @param resource the resource value to set. + * @return the SqlTriggerCreateUpdateProperties object itself. + */ + public SqlTriggerCreateUpdateProperties withResource(SqlTriggerResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlTriggerCreateUpdateProperties object itself. + */ + public SqlTriggerCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlTriggerCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetProperties.java new file mode 100644 index 0000000000000..351db0886f394 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlTriggerGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlTriggerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlTriggerGetProperties object itself. + */ + public SqlTriggerGetProperties withResource(SqlTriggerGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java new file mode 100644 index 0000000000000..3621944152690 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlTriggerGetResultsInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB trigger + */ + @JsonProperty(value = "properties") + private SqlTriggerGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB trigger. + * + * @return the innerProperties value. + */ + private SqlTriggerGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlTriggerGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlTriggerGetResultsInner object itself. + */ + public SqlTriggerGetResultsInner withResource(SqlTriggerGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.java new file mode 100644 index 0000000000000..f1bc1dda46b2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionCreateUpdateProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionCreateUpdateProperties.class); + + /* + * The standard JSON format of a userDefinedFunction + */ + @JsonProperty(value = "resource", required = true) + private SqlUserDefinedFunctionResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a userDefinedFunction. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionCreateUpdateProperties object itself. + */ + public SqlUserDefinedFunctionCreateUpdateProperties withResource(SqlUserDefinedFunctionResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlUserDefinedFunctionCreateUpdateProperties object itself. + */ + public SqlUserDefinedFunctionCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model SqlUserDefinedFunctionCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetProperties.java new file mode 100644 index 0000000000000..98bf51094f550 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private SqlUserDefinedFunctionGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionGetProperties object itself. + */ + public SqlUserDefinedFunctionGetProperties withResource(SqlUserDefinedFunctionGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java new file mode 100644 index 0000000000000..70a76792720c9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/SqlUserDefinedFunctionGetResultsInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB userDefinedFunction + */ + @JsonProperty(value = "properties") + private SqlUserDefinedFunctionGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB userDefinedFunction. + * + * @return the innerProperties value. + */ + private SqlUserDefinedFunctionGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionGetResultsInner object itself. + */ + public SqlUserDefinedFunctionGetResultsInner withResource(SqlUserDefinedFunctionGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java new file mode 100644 index 0000000000000..e29f0a07a8dc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableCreateUpdateProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to create and update Azure Cosmos DB Table. */ +@Fluent +public final class TableCreateUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableCreateUpdateProperties.class); + + /* + * The standard JSON format of a Table + */ + @JsonProperty(value = "resource", required = true) + private TableResource resource; + + /* + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "options") + private CreateUpdateOptions options; + + /** + * Get the resource property: The standard JSON format of a Table. + * + * @return the resource value. + */ + public TableResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a Table. + * + * @param resource the resource value to set. + * @return the TableCreateUpdateProperties object itself. + */ + public TableCreateUpdateProperties withResource(TableResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the TableCreateUpdateProperties object itself. + */ + public TableCreateUpdateProperties withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model TableCreateUpdateProperties")); + } else { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetProperties.java new file mode 100644 index 0000000000000..5f0546e2dc4b9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos Table. */ +@Fluent +public final class TableGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private TableGetPropertiesResource resource; + + /* + * The options property. + */ + @JsonProperty(value = "options") + private TableGetPropertiesOptions options; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public TableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the TableGetProperties object itself. + */ + public TableGetProperties withResource(TableGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public TableGetPropertiesOptions options() { + return this.options; + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the TableGetProperties object itself. + */ + public TableGetProperties withOptions(TableGetPropertiesOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.java new file mode 100644 index 0000000000000..7e32259f3cb9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/TableGetResultsInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB Table. */ +@Fluent +public final class TableGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB Table + */ + @JsonProperty(value = "properties") + private TableGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB Table. + * + * @return the innerProperties value. + */ + private TableGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public TableGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner withResource(TableGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new TableGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: The options property. + * + * @return the options value. + */ + public TableGetPropertiesOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: The options property. + * + * @param options the options value to set. + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner withOptions(TableGetPropertiesOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new TableGetProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java new file mode 100644 index 0000000000000..9dfe22999240b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an Azure Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsGetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsGetProperties.class); + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private ThroughputSettingsGetPropertiesResource resource; + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ThroughputSettingsGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsGetProperties object itself. + */ + public ThroughputSettingsGetProperties withResource(ThroughputSettingsGetPropertiesResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() != null) { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java new file mode 100644 index 0000000000000..53d226025b3e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsGetResultsInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ArmResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsGetResultsInner extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsGetResultsInner.class); + + /* + * The properties of an Azure Cosmos DB resource throughput + */ + @JsonProperty(value = "properties") + private ThroughputSettingsGetProperties innerProperties; + + /** + * Get the innerProperties property: The properties of an Azure Cosmos DB resource throughput. + * + * @return the innerProperties value. + */ + private ThroughputSettingsGetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetResultsInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public ThroughputSettingsGetPropertiesResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsGetResultsInner object itself. + */ + public ThroughputSettingsGetResultsInner withResource(ThroughputSettingsGetPropertiesResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ThroughputSettingsGetProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java new file mode 100644 index 0000000000000..38e1eab1d3b87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/ThroughputSettingsUpdateProperties.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to update Azure Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsUpdateProperties.class); + + /* + * The standard JSON format of a resource throughput + */ + @JsonProperty(value = "resource", required = true) + private ThroughputSettingsResource resource; + + /** + * Get the resource property: The standard JSON format of a resource throughput. + * + * @return the resource value. + */ + public ThroughputSettingsResource resource() { + return this.resource; + } + + /** + * Set the resource property: The standard JSON format of a resource throughput. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsUpdateProperties object itself. + */ + public ThroughputSettingsUpdateProperties withResource(ThroughputSettingsResource resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resource in model ThroughputSettingsUpdateProperties")); + } else { + resource().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..1f54217289a62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/UsageInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The usage data for a usage request. */ +@Immutable +public class UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageInner.class); + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /* + * Maximum value for this metric + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /* + * Current value for this metric + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long currentValue; + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..5140b0ddb6664 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java new file mode 100644 index 0000000000000..98db5a655ee9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.fluent; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java new file mode 100644 index 0000000000000..0a04e870558a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupInformationImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupInformation; + +public final class BackupInformationImpl implements BackupInformation { + private BackupInformationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + BackupInformationImpl( + BackupInformationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ContinuousBackupInformation continuousBackupInformation() { + return this.innerModel().continuousBackupInformation(); + } + + public BackupInformationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupResourceImpl.java new file mode 100644 index 0000000000000..705c43b293100 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/BackupResourceImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupResource; +import com.azure.resourcemanager.cosmos.generated.models.BackupResourceProperties; + +public final class BackupResourceImpl implements BackupResource { + private BackupResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + BackupResourceImpl( + BackupResourceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public BackupResourceProperties properties() { + return this.innerModel().properties(); + } + + public BackupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersClientImpl.java new file mode 100644 index 0000000000000..cc26a6c270abc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersClientImpl.java @@ -0,0 +1,2245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraClustersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ListBackups; +import com.azure.resourcemanager.cosmos.generated.models.ListClusters; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CassandraClustersClient. */ +public final class CassandraClustersClientImpl implements CassandraClustersClient { + private final ClientLogger logger = new ClientLogger(CassandraClustersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CassandraClustersService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CassandraClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CassandraClustersClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CassandraClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCassandraClusters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CassandraClustersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ClusterResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ClusterResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/repair") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> requestRepair( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RepairPostBody body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/fetchNodeStatus") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> fetchNodeStatus( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/backups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBackups( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/backups/{backupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBackup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("backupId") String backupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all managed Cassandra clusters in this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResourceInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupAsync(resourceGroupName, clusterName).block(); + } + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName) { + deleteAsync(resourceGroupName, clusterName).block(); + } + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, Context context) { + deleteAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResourceInner> beginCreateUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + Mono>> mono = createUpdateWithResponseAsync(resourceGroupName, clusterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterResourceInner.class, + ClusterResourceInner.class, + Context.NONE); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResourceInner> beginCreateUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, clusterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterResourceInner.class, ClusterResourceInner.class, context); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, body).getSyncPoller(); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, body, context).getSyncPoller(); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResourceInner createUpdate(String resourceGroupName, String clusterName, ClusterResourceInner body) { + return createUpdateAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update + * only some properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body The properties specifying the desired state of the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResourceInner createUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return createUpdateAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResourceInner> beginUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterResourceInner.class, + ClusterResourceInner.class, + Context.NONE); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterResourceInner> beginUpdateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterResourceInner.class, ClusterResourceInner.class, context); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + return beginUpdateAsync(resourceGroupName, clusterName, body).getSyncPoller(); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, body, context).getSyncPoller(); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body) { + return beginUpdateAsync(resourceGroupName, clusterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResourceInner update(String resourceGroupName, String clusterName, ClusterResourceInner body) { + return updateAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Updates some of the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Parameters to provide for specifying the managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return representation of a managed Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterResourceInner update( + String resourceGroupName, String clusterName, ClusterResourceInner body, Context context) { + return updateAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> requestRepairWithResponseAsync( + String resourceGroupName, String clusterName, RepairPostBody body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .requestRepair( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> requestRepairWithResponseAsync( + String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .requestRepair( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRequestRepairAsync( + String resourceGroupName, String clusterName, RepairPostBody body) { + Mono>> mono = requestRepairWithResponseAsync(resourceGroupName, clusterName, body); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRequestRepairAsync( + String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + requestRepairWithResponseAsync(resourceGroupName, clusterName, body, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRequestRepair( + String resourceGroupName, String clusterName, RepairPostBody body) { + return beginRequestRepairAsync(resourceGroupName, clusterName, body).getSyncPoller(); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRequestRepair( + String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + return beginRequestRepairAsync(resourceGroupName, clusterName, body, context).getSyncPoller(); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono requestRepairAsync(String resourceGroupName, String clusterName, RepairPostBody body) { + return beginRequestRepairAsync(resourceGroupName, clusterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono requestRepairAsync( + String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + return beginRequestRepairAsync(resourceGroupName, clusterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body) { + requestRepairAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + requestRepairAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> fetchNodeStatusWithResponseAsync( + String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .fetchNodeStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> fetchNodeStatusWithResponseAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .fetchNodeStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterNodeStatusInner> beginFetchNodeStatusAsync( + String resourceGroupName, String clusterName) { + Mono>> mono = fetchNodeStatusWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterNodeStatusInner.class, + ClusterNodeStatusInner.class, + Context.NONE); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterNodeStatusInner> beginFetchNodeStatusAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + fetchNodeStatusWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ClusterNodeStatusInner.class, + ClusterNodeStatusInner.class, + context); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterNodeStatusInner> beginFetchNodeStatus( + String resourceGroupName, String clusterName) { + return beginFetchNodeStatusAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterNodeStatusInner> beginFetchNodeStatus( + String resourceGroupName, String clusterName, Context context) { + return beginFetchNodeStatusAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchNodeStatusAsync(String resourceGroupName, String clusterName) { + return beginFetchNodeStatusAsync(resourceGroupName, clusterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchNodeStatusAsync( + String resourceGroupName, String clusterName, Context context) { + return beginFetchNodeStatusAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterNodeStatusInner fetchNodeStatus(String resourceGroupName, String clusterName) { + return fetchNodeStatusAsync(resourceGroupName, clusterName).block(); + } + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterNodeStatusInner fetchNodeStatus(String resourceGroupName, String clusterName, Context context) { + return fetchNodeStatusAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBackupsSinglePageAsync( + String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBackups( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBackupsSinglePageAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBackups( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBackupsAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listBackupsSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBackupsAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listBackupsSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBackups(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listBackupsAsync(resourceGroupName, clusterName)); + } + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBackups( + String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listBackupsAsync(resourceGroupName, clusterName, context)); + } + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupWithResponseAsync( + String resourceGroupName, String clusterName, String backupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (backupId == null) { + return Mono.error(new IllegalArgumentException("Parameter backupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBackup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + backupId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBackupWithResponseAsync( + String resourceGroupName, String clusterName, String backupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (backupId == null) { + return Mono.error(new IllegalArgumentException("Parameter backupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBackup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + backupId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getBackupAsync(String resourceGroupName, String clusterName, String backupId) { + return getBackupWithResponseAsync(resourceGroupName, clusterName, backupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResourceInner getBackup(String resourceGroupName, String clusterName, String backupId) { + return getBackupAsync(resourceGroupName, clusterName, backupId).block(); + } + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBackupWithResponse( + String resourceGroupName, String clusterName, String backupId, Context context) { + return getBackupWithResponseAsync(resourceGroupName, clusterName, backupId, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersImpl.java new file mode 100644 index 0000000000000..91d18504f471c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraClustersImpl.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraClustersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraClusters; +import com.azure.resourcemanager.cosmos.generated.models.ClusterNodeStatus; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CassandraClustersImpl implements CassandraClusters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraClustersImpl.class); + + private final CassandraClustersClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CassandraClustersImpl( + CassandraClustersClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ClusterResourceImpl(inner1, this.manager())); + } + + public ClusterResource getByResourceGroup(String resourceGroupName, String clusterName) { + ClusterResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ClusterResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String clusterName) { + this.serviceClient().delete(resourceGroupName, clusterName); + } + + public void delete(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, context); + } + + public void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body) { + this.serviceClient().requestRepair(resourceGroupName, clusterName, body); + } + + public void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body, Context context) { + this.serviceClient().requestRepair(resourceGroupName, clusterName, body, context); + } + + public ClusterNodeStatus fetchNodeStatus(String resourceGroupName, String clusterName) { + ClusterNodeStatusInner inner = this.serviceClient().fetchNodeStatus(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterNodeStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public ClusterNodeStatus fetchNodeStatus(String resourceGroupName, String clusterName, Context context) { + ClusterNodeStatusInner inner = this.serviceClient().fetchNodeStatus(resourceGroupName, clusterName, context); + if (inner != null) { + return new ClusterNodeStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listBackups(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().listBackups(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new BackupResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBackups(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().listBackups(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new BackupResourceImpl(inner1, this.manager())); + } + + public BackupResource getBackup(String resourceGroupName, String clusterName, String backupId) { + BackupResourceInner inner = this.serviceClient().getBackup(resourceGroupName, clusterName, backupId); + if (inner != null) { + return new BackupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getBackupWithResponse( + String resourceGroupName, String clusterName, String backupId, Context context) { + Response inner = + this.serviceClient().getBackupWithResponse(resourceGroupName, clusterName, backupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ClusterResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + this.delete(resourceGroupName, clusterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + this.delete(resourceGroupName, clusterName, context); + } + + private CassandraClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public ClusterResourceImpl define(String name) { + return new ClusterResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java new file mode 100644 index 0000000000000..cc6caa1a06ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersClientImpl.java @@ -0,0 +1,1360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraDataCentersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ListDataCenters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CassandraDataCentersClient. */ +public final class CassandraDataCentersClientImpl implements CassandraDataCentersClient { + private final ClientLogger logger = new ClientLogger(CassandraDataCentersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CassandraDataCentersService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CassandraDataCentersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CassandraDataCentersClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(CassandraDataCentersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCassandraDataCenters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CassandraDataCentersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/dataCenters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("dataCenterName") String dataCenterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("dataCenterName") String dataCenterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("dataCenterName") String dataCenterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataCenterResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @PathParam("dataCenterName") String dataCenterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataCenterResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String clusterName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, clusterName)); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String clusterName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, clusterName, context)); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String clusterName) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterName)); + } + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String clusterName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterName, context)); + } + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String clusterName, String dataCenterName) { + return getWithResponseAsync(resourceGroupName, clusterName, dataCenterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCenterResourceInner get(String resourceGroupName, String clusterName, String dataCenterName) { + return getAsync(resourceGroupName, clusterName, dataCenterName).block(); + } + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterName, dataCenterName, context).block(); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String dataCenterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, dataCenterName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, clusterName, dataCenterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String dataCenterName) { + return beginDeleteAsync(resourceGroupName, clusterName, dataCenterName).getSyncPoller(); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, dataCenterName, context).getSyncPoller(); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, String dataCenterName) { + return beginDeleteAsync(resourceGroupName, clusterName, dataCenterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, dataCenterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, String dataCenterName) { + deleteAsync(resourceGroupName, clusterName, dataCenterName).block(); + } + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterName, String dataCenterName, Context context) { + deleteAsync(resourceGroupName, clusterName, dataCenterName, context).block(); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataCenterResourceInner> beginCreateUpdateAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, clusterName, dataCenterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DataCenterResourceInner.class, + DataCenterResourceInner.class, + Context.NONE); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataCenterResourceInner> beginCreateUpdateAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, clusterName, dataCenterName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DataCenterResourceInner.class, + DataCenterResourceInner.class, + context); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> beginCreateUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, dataCenterName, body).getSyncPoller(); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> beginCreateUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, context).getSyncPoller(); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, dataCenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return beginCreateUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCenterResourceInner createUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return createUpdateAsync(resourceGroupName, clusterName, dataCenterName, body).block(); + } + + /** + * Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCenterResourceInner createUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return createUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, context).block(); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (dataCenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataCenterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + dataCenterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataCenterResourceInner> beginUpdateAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, clusterName, dataCenterName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DataCenterResourceInner.class, + DataCenterResourceInner.class, + Context.NONE); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataCenterResourceInner> beginUpdateAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, clusterName, dataCenterName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DataCenterResourceInner.class, + DataCenterResourceInner.class, + context); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> beginUpdate( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return beginUpdateAsync(resourceGroupName, clusterName, dataCenterName, body).getSyncPoller(); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataCenterResourceInner> beginUpdate( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, context).getSyncPoller(); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return beginUpdateAsync(resourceGroupName, clusterName, dataCenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return beginUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCenterResourceInner update( + String resourceGroupName, String clusterName, String dataCenterName, DataCenterResourceInner body) { + return updateAsync(resourceGroupName, clusterName, dataCenterName, body).block(); + } + + /** + * Update some of the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param body Parameters to provide for specifying the managed Cassandra data center. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed Cassandra data center. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCenterResourceInner update( + String resourceGroupName, + String clusterName, + String dataCenterName, + DataCenterResourceInner body, + Context context) { + return updateAsync(resourceGroupName, clusterName, dataCenterName, body, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersImpl.java new file mode 100644 index 0000000000000..e554b11d70cc9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraDataCentersImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraDataCentersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraDataCenters; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CassandraDataCentersImpl implements CassandraDataCenters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraDataCentersImpl.class); + + private final CassandraDataCentersClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CassandraDataCentersImpl( + CassandraDataCentersClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String clusterName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, clusterName); + return Utils.mapPage(inner, inner1 -> new DataCenterResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String clusterName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, clusterName, context); + return Utils.mapPage(inner, inner1 -> new DataCenterResourceImpl(inner1, this.manager())); + } + + public DataCenterResource get(String resourceGroupName, String clusterName, String dataCenterName) { + DataCenterResourceInner inner = this.serviceClient().get(resourceGroupName, clusterName, dataCenterName); + if (inner != null) { + return new DataCenterResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String clusterName, String dataCenterName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, clusterName, dataCenterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataCenterResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String clusterName, String dataCenterName) { + this.serviceClient().delete(resourceGroupName, clusterName, dataCenterName); + } + + public void delete(String resourceGroupName, String clusterName, String dataCenterName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, dataCenterName, context); + } + + public DataCenterResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + return this.getWithResponse(resourceGroupName, clusterName, dataCenterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + return this.getWithResponse(resourceGroupName, clusterName, dataCenterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + this.delete(resourceGroupName, clusterName, dataCenterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String clusterName = Utils.getValueFromIdByName(id, "cassandraClusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraClusters'.", id))); + } + String dataCenterName = Utils.getValueFromIdByName(id, "dataCenters"); + if (dataCenterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataCenters'.", id))); + } + this.delete(resourceGroupName, clusterName, dataCenterName, context); + } + + private CassandraDataCentersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public DataCenterResourceImpl define(String name) { + return new DataCenterResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java new file mode 100644 index 0000000000000..f3a1072bb7c0f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraKeyspaceGetResultsImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class CassandraKeyspaceGetResultsImpl + implements CassandraKeyspaceGetResults, CassandraKeyspaceGetResults.Definition, CassandraKeyspaceGetResults.Update { + private CassandraKeyspaceGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public CassandraKeyspaceGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public CassandraKeyspaceGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CassandraKeyspaceGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String keyspaceName; + + private CassandraKeyspaceCreateUpdateParameters createCreateUpdateCassandraKeyspaceParameters; + + private CassandraKeyspaceCreateUpdateParameters updateCreateUpdateCassandraKeyspaceParameters; + + public CassandraKeyspaceGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public CassandraKeyspaceGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraKeyspace( + resourceGroupName, + accountName, + keyspaceName, + createCreateUpdateCassandraKeyspaceParameters, + Context.NONE); + return this; + } + + public CassandraKeyspaceGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraKeyspace( + resourceGroupName, + accountName, + keyspaceName, + createCreateUpdateCassandraKeyspaceParameters, + context); + return this; + } + + CassandraKeyspaceGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new CassandraKeyspaceGetResultsInner(); + this.serviceManager = serviceManager; + this.keyspaceName = name; + this.createCreateUpdateCassandraKeyspaceParameters = new CassandraKeyspaceCreateUpdateParameters(); + } + + public CassandraKeyspaceGetResultsImpl update() { + this.updateCreateUpdateCassandraKeyspaceParameters = new CassandraKeyspaceCreateUpdateParameters(); + return this; + } + + public CassandraKeyspaceGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraKeyspace( + resourceGroupName, + accountName, + keyspaceName, + updateCreateUpdateCassandraKeyspaceParameters, + Context.NONE); + return this; + } + + public CassandraKeyspaceGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraKeyspace( + resourceGroupName, + accountName, + keyspaceName, + updateCreateUpdateCassandraKeyspaceParameters, + context); + return this; + } + + CassandraKeyspaceGetResultsImpl( + CassandraKeyspaceGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = Utils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + } + + public CassandraKeyspaceGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE) + .getValue(); + return this; + } + + public CassandraKeyspaceGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context) + .getValue(); + return this; + } + + public CassandraKeyspaceGetResultsImpl withRegion(Region location) { + this.createCreateUpdateCassandraKeyspaceParameters.withLocation(location.toString()); + return this; + } + + public CassandraKeyspaceGetResultsImpl withRegion(String location) { + this.createCreateUpdateCassandraKeyspaceParameters.withLocation(location); + return this; + } + + public CassandraKeyspaceGetResultsImpl withResource(CassandraKeyspaceResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withResource(resource); + return this; + } + } + + public CassandraKeyspaceGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withTags(tags); + return this; + } + } + + public CassandraKeyspaceGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withIdentity(identity); + return this; + } + } + + public CassandraKeyspaceGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraKeyspaceParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateCassandraKeyspaceParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java new file mode 100644 index 0000000000000..9674729df82a4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesClientImpl.java @@ -0,0 +1,6832 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceListResult; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableListResult; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CassandraResourcesClient. */ +public final class CassandraResourcesClientImpl implements CassandraResourcesClient { + private final ClientLogger logger = new ClientLogger(CassandraResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CassandraResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CassandraResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CassandraResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CassandraResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCassandraResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CassandraResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCassandraKeyspaces( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCassandraKeyspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraKeyspaceThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCassandraKeyspaceThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraKeyspaceToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraKeyspaceToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCassandraTables( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCassandraTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCassandraTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraTableToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraTableToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCassandraViews( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraView( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateCassandraView( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCassandraView( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCassandraViewThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateCassandraViewThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraViewToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateCassandraViewToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("keyspaceName") String keyspaceName, + @PathParam("viewName") String viewName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraKeyspacesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraKeyspacesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraKeyspaces( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraKeyspacesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listCassandraKeyspacesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraKeyspacesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listCassandraKeyspacesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listCassandraKeyspacesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listCassandraKeyspacesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Gets the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraKeyspaceWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (createUpdateCassandraKeyspaceParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null.")); + } else { + createUpdateCassandraKeyspaceParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + createUpdateCassandraKeyspaceParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraKeyspaceWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (createUpdateCassandraKeyspaceParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null.")); + } else { + createUpdateCassandraKeyspaceParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + createUpdateCassandraKeyspaceParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + Mono>> mono = + createUpdateCassandraKeyspaceWithResponseAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraKeyspaceGetResultsInner.class, + CassandraKeyspaceGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateCassandraKeyspaceWithResponseAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraKeyspaceGetResultsInner.class, + CassandraKeyspaceGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraKeyspaceGetResultsInner> + beginCreateUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraKeyspaceAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return beginCreateUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return createUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @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 createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra keyspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace( + String resourceGroupName, + String accountName, + String keyspaceName, + CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, + Context context) { + return createUpdateCassandraKeyspaceAsync( + resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraKeyspaceWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteCassandraKeyspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + deleteCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCassandraKeyspaceWithResponseAsync(resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraKeyspaceAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginDeleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + deleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + deleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraKeyspaceThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return getCassandraKeyspaceThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraKeyspaceThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraKeyspaceThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateCassandraKeyspaceThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCassandraKeyspaceThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraKeyspaceThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateCassandraKeyspaceThroughputAsync( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + migrateCassandraKeyspaceToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraKeyspaceToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale(String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName) { + return migrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return migrateCassandraKeyspaceToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, context).block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraKeyspaceToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + Mono>> mono = + migrateCassandraKeyspaceToManualThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraKeyspaceToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraKeyspaceToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return beginMigrateCassandraKeyspaceToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + return migrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return migrateCassandraKeyspaceToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, context) + .block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraTablesSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraTablesSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraTablesAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedFlux<>(() -> listCassandraTablesSinglePageAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraTablesAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedFlux<>( + () -> listCassandraTablesSinglePageAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedIterable<>(listCassandraTablesAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedIterable<>(listCassandraTablesAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return getCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraTableWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateCassandraTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraTableParameters is required and cannot be null.")); + } else { + createUpdateCassandraTableParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + createUpdateCassandraTableParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraTableWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateCassandraTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraTableParameters is required and cannot be null.")); + } else { + createUpdateCassandraTableParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + createUpdateCassandraTableParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + Mono>> mono = + createUpdateCassandraTableWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraTableGetResultsInner.class, + CassandraTableGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateCassandraTableWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraTableGetResultsInner.class, + CassandraTableGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraTableGetResultsInner> + beginCreateUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraTableAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return beginCreateUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraTableGetResultsInner createUpdateCassandraTable( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, + Context context) { + return createUpdateCassandraTableAsync( + resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraTableWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteCassandraTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + deleteCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCassandraTableWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraTableAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginDeleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + deleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + deleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraTableThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return getCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCassandraTableThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraTableThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateCassandraTableThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + migrateCassandraTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraTableToAutoscaleWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return migrateCassandraTableToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + Mono>> mono = + migrateCassandraTableToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraTableToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraTableToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return beginMigrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return migrateCassandraTableToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + return migrateCassandraTableToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, tableName, context) + .block(); + } + + /** + * Lists the Cassandra materialized views 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraViewsSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCassandraViews( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Cassandra materialized views 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCassandraViewsSinglePageAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCassandraViews( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Cassandra materialized views 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraViewsAsync( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedFlux<>(() -> listCassandraViewsSinglePageAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * Lists the Cassandra materialized views 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCassandraViewsAsync( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedFlux<>( + () -> listCassandraViewsSinglePageAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * Lists the Cassandra materialized views 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName) { + return new PagedIterable<>(listCassandraViewsAsync(resourceGroupName, accountName, keyspaceName)); + } + + /** + * Lists the Cassandra materialized views 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + return new PagedIterable<>(listCassandraViewsAsync(resourceGroupName, accountName, keyspaceName, context)); + } + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraViewWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraViewWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraViewAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return getCassandraViewWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraViewGetResultsInner getCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return getCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName).block(); + } + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraViewWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return getCassandraViewWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraViewWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + if (createUpdateCassandraViewParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraViewParameters is required and cannot be null.")); + } else { + createUpdateCassandraViewParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + createUpdateCassandraViewParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateCassandraViewWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + if (createUpdateCassandraViewParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateCassandraViewParameters is required and cannot be null.")); + } else { + createUpdateCassandraViewParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + createUpdateCassandraViewParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraViewGetResultsInner> + beginCreateUpdateCassandraViewAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) { + Mono>> mono = + createUpdateCassandraViewWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraViewGetResultsInner.class, + CassandraViewGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CassandraViewGetResultsInner> + beginCreateUpdateCassandraViewAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateCassandraViewWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CassandraViewGetResultsInner.class, + CassandraViewGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraViewGetResultsInner> + beginCreateUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) { + return beginCreateUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CassandraViewGetResultsInner> + beginCreateUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context) { + return beginCreateUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraViewAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) { + return beginCreateUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateCassandraViewAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context) { + return beginCreateUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraViewGetResultsInner createUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) { + return createUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra View. + * + * @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 viewName Cosmos DB view name. + * @param createUpdateCassandraViewParameters The parameters to provide for the current Cassandra View. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Cassandra view. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CassandraViewGetResultsInner createUpdateCassandraView( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, + Context context) { + return createUpdateCassandraViewAsync( + resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraViewWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteCassandraViewWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteCassandraView( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraViewAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + Mono>> mono = + deleteCassandraViewWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCassandraViewAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCassandraViewWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginDeleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginDeleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraViewAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginDeleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteCassandraViewAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginDeleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + deleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + deleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, context).block(); + } + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraViewThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCassandraViewThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCassandraViewThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCassandraViewThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getCassandraViewThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return getCassandraViewThroughputWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getCassandraViewThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return getCassandraViewThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName).block(); + } + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCassandraViewThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return getCassandraViewThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraViewThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCassandraViewThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateCassandraViewThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCassandraViewThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateCassandraViewThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateCassandraViewThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraViewThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCassandraViewThroughputAsync( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateCassandraViewThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraViewToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraViewToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraViewToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraViewToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + Mono>> mono = + migrateCassandraViewToAutoscaleWithResponseAsync(resourceGroupName, accountName, keyspaceName, viewName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraViewToAutoscaleWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginMigrateCassandraViewToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, viewName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginMigrateCassandraViewToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraViewToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginMigrateCassandraViewToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, viewName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraViewToAutoscaleAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginMigrateCassandraViewToAutoscaleAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return migrateCassandraViewToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, viewName).block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return migrateCassandraViewToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, viewName, context) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraViewToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateCassandraViewToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateCassandraViewToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyspaceName is required and cannot be null.")); + } + if (viewName == null) { + return Mono.error(new IllegalArgumentException("Parameter viewName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateCassandraViewToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + keyspaceName, + viewName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + Mono>> mono = + migrateCassandraViewToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateCassandraViewToManualThroughputWithResponseAsync( + resourceGroupName, accountName, keyspaceName, viewName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginMigrateCassandraViewToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginMigrateCassandraViewToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .getSyncPoller(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraViewToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return beginMigrateCassandraViewToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateCassandraViewToManualThroughputAsync( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return beginMigrateCassandraViewToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + return migrateCassandraViewToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName) + .block(); + } + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + return migrateCassandraViewToManualThroughputAsync( + resourceGroupName, accountName, keyspaceName, viewName, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java new file mode 100644 index 0000000000000..e2b5d54bb8d10 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraResourcesImpl.java @@ -0,0 +1,986 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraResources; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CassandraResourcesImpl implements CassandraResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraResourcesImpl.class); + + private final CassandraResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CassandraResourcesImpl( + CassandraResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraKeyspaces(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new CassandraKeyspaceGetResultsImpl(inner1, this.manager())); + } + + public CassandraKeyspaceGetResults getCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + CassandraKeyspaceGetResultsInner inner = + this.serviceClient().getCassandraKeyspace(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new CassandraKeyspaceGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CassandraKeyspaceGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + this.serviceClient().deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName); + } + + public void deleteCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + this.serviceClient().deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, context); + } + + public ThroughputSettingsGetResults getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getCassandraKeyspaceThroughput(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraKeyspaceThroughputWithResponse(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraKeyspaceThroughput( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraKeyspaceThroughput( + resourceGroupName, accountName, keyspaceName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateCassandraKeyspaceToAutoscale(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToAutoscale(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToManualThroughput(resourceGroupName, accountName, keyspaceName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraKeyspaceToManualThroughput(resourceGroupName, accountName, keyspaceName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName) { + PagedIterable inner = + this.serviceClient().listCassandraTables(resourceGroupName, accountName, keyspaceName); + return Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraTables(resourceGroupName, accountName, keyspaceName, context); + return Utils.mapPage(inner, inner1 -> new CassandraTableGetResultsImpl(inner1, this.manager())); + } + + public CassandraTableGetResults getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraTableGetResultsInner inner = + this.serviceClient().getCassandraTable(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new CassandraTableGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CassandraTableGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + this.serviceClient().deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName); + } + + public void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + this.serviceClient().deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + public ThroughputSettingsGetResults getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getCassandraTableThroughput(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraTableThroughputWithResponse( + resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraTableThroughput( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraTableThroughput( + resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToAutoscale(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToAutoscale(resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToManualThroughput(resourceGroupName, accountName, keyspaceName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraTableToManualThroughput( + resourceGroupName, accountName, keyspaceName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName) { + PagedIterable inner = + this.serviceClient().listCassandraViews(resourceGroupName, accountName, keyspaceName); + return Utils.mapPage(inner, inner1 -> new CassandraViewGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listCassandraViews(resourceGroupName, accountName, keyspaceName, context); + return Utils.mapPage(inner, inner1 -> new CassandraViewGetResultsImpl(inner1, this.manager())); + } + + public CassandraViewGetResults getCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + CassandraViewGetResultsInner inner = + this.serviceClient().getCassandraView(resourceGroupName, accountName, keyspaceName, viewName); + if (inner != null) { + return new CassandraViewGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraViewWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraViewWithResponse(resourceGroupName, accountName, keyspaceName, viewName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CassandraViewGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + this.serviceClient().deleteCassandraView(resourceGroupName, accountName, keyspaceName, viewName); + } + + public void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + this.serviceClient().deleteCassandraView(resourceGroupName, accountName, keyspaceName, viewName, context); + } + + public ThroughputSettingsGetResults getCassandraViewThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getCassandraViewThroughput(resourceGroupName, accountName, keyspaceName, viewName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getCassandraViewThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + Response inner = + this + .serviceClient() + .getCassandraViewThroughputWithResponse( + resourceGroupName, accountName, keyspaceName, viewName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraViewThroughput( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateCassandraViewThroughput( + resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraViewToAutoscale(resourceGroupName, accountName, keyspaceName, viewName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraViewToAutoscale(resourceGroupName, accountName, keyspaceName, viewName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraViewToManualThroughput(resourceGroupName, accountName, keyspaceName, viewName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateCassandraViewToManualThroughput( + resourceGroupName, accountName, keyspaceName, viewName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public CassandraKeyspaceGetResults getCassandraKeyspaceById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + return this + .getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, Context.NONE) + .getValue(); + } + + public Response getCassandraKeyspaceByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + return this.getCassandraKeyspaceWithResponse(resourceGroupName, accountName, keyspaceName, context); + } + + public CassandraTableGetResults getCassandraTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE) + .getValue(); + } + + public Response getCassandraTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + public CassandraViewGetResults getCassandraViewById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String viewName = Utils.getValueFromIdByName(id, "views"); + if (viewName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'views'.", id))); + } + return this + .getCassandraViewWithResponse(resourceGroupName, accountName, keyspaceName, viewName, Context.NONE) + .getValue(); + } + + public Response getCassandraViewByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String viewName = Utils.getValueFromIdByName(id, "views"); + if (viewName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'views'.", id))); + } + return this.getCassandraViewWithResponse(resourceGroupName, accountName, keyspaceName, viewName, context); + } + + public void deleteCassandraKeyspaceById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + this.deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, Context.NONE); + } + + public void deleteCassandraKeyspaceByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + this.deleteCassandraKeyspace(resourceGroupName, accountName, keyspaceName, context); + } + + public void deleteCassandraTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE); + } + + public void deleteCassandraTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteCassandraTable(resourceGroupName, accountName, keyspaceName, tableName, context); + } + + public void deleteCassandraViewById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String viewName = Utils.getValueFromIdByName(id, "views"); + if (viewName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'views'.", id))); + } + this.deleteCassandraView(resourceGroupName, accountName, keyspaceName, viewName, Context.NONE); + } + + public void deleteCassandraViewByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String keyspaceName = Utils.getValueFromIdByName(id, "cassandraKeyspaces"); + if (keyspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'cassandraKeyspaces'.", id))); + } + String viewName = Utils.getValueFromIdByName(id, "views"); + if (viewName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'views'.", id))); + } + this.deleteCassandraView(resourceGroupName, accountName, keyspaceName, viewName, context); + } + + private CassandraResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public CassandraKeyspaceGetResultsImpl defineUpdateCassandraKeyspace(String name) { + return new CassandraKeyspaceGetResultsImpl(name, this.manager()); + } + + public CassandraTableGetResultsImpl defineUpdateCassandraTable(String name) { + return new CassandraTableGetResultsImpl(name, this.manager()); + } + + public CassandraViewGetResultsImpl defineUpdateCassandraView(String name) { + return new CassandraViewGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.java new file mode 100644 index 0000000000000..142a17fb4ab16 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraTableGetResultsImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class CassandraTableGetResultsImpl + implements CassandraTableGetResults, CassandraTableGetResults.Definition, CassandraTableGetResults.Update { + private CassandraTableGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public CassandraTableGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public CassandraTableGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CassandraTableGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String keyspaceName; + + private String tableName; + + private CassandraTableCreateUpdateParameters createCreateUpdateCassandraTableParameters; + + private CassandraTableCreateUpdateParameters updateCreateUpdateCassandraTableParameters; + + public CassandraTableGetResultsImpl withExistingCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.keyspaceName = keyspaceName; + return this; + } + + public CassandraTableGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraTable( + resourceGroupName, + accountName, + keyspaceName, + tableName, + createCreateUpdateCassandraTableParameters, + Context.NONE); + return this; + } + + public CassandraTableGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraTable( + resourceGroupName, + accountName, + keyspaceName, + tableName, + createCreateUpdateCassandraTableParameters, + context); + return this; + } + + CassandraTableGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new CassandraTableGetResultsInner(); + this.serviceManager = serviceManager; + this.tableName = name; + this.createCreateUpdateCassandraTableParameters = new CassandraTableCreateUpdateParameters(); + } + + public CassandraTableGetResultsImpl update() { + this.updateCreateUpdateCassandraTableParameters = new CassandraTableCreateUpdateParameters(); + return this; + } + + public CassandraTableGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraTable( + resourceGroupName, + accountName, + keyspaceName, + tableName, + updateCreateUpdateCassandraTableParameters, + Context.NONE); + return this; + } + + public CassandraTableGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraTable( + resourceGroupName, + accountName, + keyspaceName, + tableName, + updateCreateUpdateCassandraTableParameters, + context); + return this; + } + + CassandraTableGetResultsImpl( + CassandraTableGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = Utils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + } + + public CassandraTableGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, Context.NONE) + .getValue(); + return this; + } + + public CassandraTableGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraTableWithResponse(resourceGroupName, accountName, keyspaceName, tableName, context) + .getValue(); + return this; + } + + public CassandraTableGetResultsImpl withRegion(Region location) { + this.createCreateUpdateCassandraTableParameters.withLocation(location.toString()); + return this; + } + + public CassandraTableGetResultsImpl withRegion(String location) { + this.createCreateUpdateCassandraTableParameters.withLocation(location); + return this; + } + + public CassandraTableGetResultsImpl withResource(CassandraTableResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withResource(resource); + return this; + } + } + + public CassandraTableGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withTags(tags); + return this; + } + } + + public CassandraTableGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withIdentity(identity); + return this; + } + } + + public CassandraTableGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraTableParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateCassandraTableParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraViewGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraViewGetResultsImpl.java new file mode 100644 index 0000000000000..bb5a43a65fd7d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CassandraViewGetResultsImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewGetResults; +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class CassandraViewGetResultsImpl + implements CassandraViewGetResults, CassandraViewGetResults.Definition, CassandraViewGetResults.Update { + private CassandraViewGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public CassandraViewGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public CassandraViewGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CassandraViewGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String keyspaceName; + + private String viewName; + + private CassandraViewCreateUpdateParameters createCreateUpdateCassandraViewParameters; + + private CassandraViewCreateUpdateParameters updateCreateUpdateCassandraViewParameters; + + public CassandraViewGetResultsImpl withExistingCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.keyspaceName = keyspaceName; + return this; + } + + public CassandraViewGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraView( + resourceGroupName, + accountName, + keyspaceName, + viewName, + createCreateUpdateCassandraViewParameters, + Context.NONE); + return this; + } + + public CassandraViewGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraView( + resourceGroupName, + accountName, + keyspaceName, + viewName, + createCreateUpdateCassandraViewParameters, + context); + return this; + } + + CassandraViewGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new CassandraViewGetResultsInner(); + this.serviceManager = serviceManager; + this.viewName = name; + this.createCreateUpdateCassandraViewParameters = new CassandraViewCreateUpdateParameters(); + } + + public CassandraViewGetResultsImpl update() { + this.updateCreateUpdateCassandraViewParameters = new CassandraViewCreateUpdateParameters(); + return this; + } + + public CassandraViewGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraView( + resourceGroupName, + accountName, + keyspaceName, + viewName, + updateCreateUpdateCassandraViewParameters, + Context.NONE); + return this; + } + + public CassandraViewGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .createUpdateCassandraView( + resourceGroupName, + accountName, + keyspaceName, + viewName, + updateCreateUpdateCassandraViewParameters, + context); + return this; + } + + CassandraViewGetResultsImpl( + CassandraViewGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.keyspaceName = Utils.getValueFromIdByName(innerObject.id(), "cassandraKeyspaces"); + this.viewName = Utils.getValueFromIdByName(innerObject.id(), "views"); + } + + public CassandraViewGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraViewWithResponse(resourceGroupName, accountName, keyspaceName, viewName, Context.NONE) + .getValue(); + return this; + } + + public CassandraViewGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraResources() + .getCassandraViewWithResponse(resourceGroupName, accountName, keyspaceName, viewName, context) + .getValue(); + return this; + } + + public CassandraViewGetResultsImpl withRegion(Region location) { + this.createCreateUpdateCassandraViewParameters.withLocation(location.toString()); + return this; + } + + public CassandraViewGetResultsImpl withRegion(String location) { + this.createCreateUpdateCassandraViewParameters.withLocation(location); + return this; + } + + public CassandraViewGetResultsImpl withResource(CassandraViewResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraViewParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateCassandraViewParameters.withResource(resource); + return this; + } + } + + public CassandraViewGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraViewParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateCassandraViewParameters.withTags(tags); + return this; + } + } + + public CassandraViewGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraViewParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateCassandraViewParameters.withIdentity(identity); + return this; + } + } + + public CassandraViewGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateCassandraViewParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateCassandraViewParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterNodeStatusImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterNodeStatusImpl.java new file mode 100644 index 0000000000000..2e3bf5efa348b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterNodeStatusImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner; +import com.azure.resourcemanager.cosmos.generated.models.ClusterNodeStatus; +import com.azure.resourcemanager.cosmos.generated.models.ClusterNodeStatusNodesItem; +import java.util.Collections; +import java.util.List; + +public final class ClusterNodeStatusImpl implements ClusterNodeStatus { + private ClusterNodeStatusInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + ClusterNodeStatusImpl( + ClusterNodeStatusInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List nodes() { + List inner = this.innerModel().nodes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ClusterNodeStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterResourceImpl.java new file mode 100644 index 0000000000000..50c8adc19db98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ClusterResourceImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ClusterNodeStatus; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; +import java.util.Collections; +import java.util.Map; + +public final class ClusterResourceImpl implements ClusterResource, ClusterResource.Definition, ClusterResource.Update { + private ClusterResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public ClusterResourceProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ClusterResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + public ClusterResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ClusterResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .createUpdate(resourceGroupName, clusterName, this.innerModel(), Context.NONE); + return this; + } + + public ClusterResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .createUpdate(resourceGroupName, clusterName, this.innerModel(), context); + return this; + } + + ClusterResourceImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new ClusterResourceInner(); + this.serviceManager = serviceManager; + this.clusterName = name; + } + + public ClusterResourceImpl update() { + return this; + } + + public ClusterResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .update(resourceGroupName, clusterName, this.innerModel(), Context.NONE); + return this; + } + + public ClusterResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .update(resourceGroupName, clusterName, this.innerModel(), context); + return this; + } + + ClusterResourceImpl( + ClusterResourceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "cassandraClusters"); + } + + public ClusterResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public ClusterResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, context) + .getValue(); + return this; + } + + public void requestRepair(RepairPostBody body) { + serviceManager.cassandraClusters().requestRepair(resourceGroupName, clusterName, body); + } + + public void requestRepair(RepairPostBody body, Context context) { + serviceManager.cassandraClusters().requestRepair(resourceGroupName, clusterName, body, context); + } + + public ClusterNodeStatus fetchNodeStatus() { + return serviceManager.cassandraClusters().fetchNodeStatus(resourceGroupName, clusterName); + } + + public ClusterNodeStatus fetchNodeStatus(Context context) { + return serviceManager.cassandraClusters().fetchNodeStatus(resourceGroupName, clusterName, context); + } + + public ClusterResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ClusterResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ClusterResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ClusterResourceImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ClusterResourceImpl withProperties(ClusterResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java new file mode 100644 index 0000000000000..266425390ab8e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionRegionsClient. */ +public final class CollectionPartitionRegionsClientImpl implements CollectionPartitionRegionsClient { + private final ClientLogger logger = new ClientLogger(CollectionPartitionRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionPartitionRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionPartitionRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionPartitionRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + CollectionPartitionRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionPartitionRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionPartitionRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitions/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java new file mode 100644 index 0000000000000..317925c72d5cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionRegionsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitionRegions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionPartitionRegionsImpl implements CollectionPartitionRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionPartitionRegionsImpl.class); + + private final CollectionPartitionRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionPartitionRegionsImpl( + CollectionPartitionRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private CollectionPartitionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java new file mode 100644 index 0000000000000..5da22a2ed3ffd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsClientImpl.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionPartitionsClient. */ +public final class CollectionPartitionsClientImpl implements CollectionPartitionsClient { + private final ClientLogger logger = new ClientLogger(CollectionPartitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionPartitionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionPartitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionPartitionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(CollectionPartitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionPartitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionPartitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions" + + "/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java new file mode 100644 index 0000000000000..2c50c6e22a063 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionPartitionsImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionPartitions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionPartitionsImpl implements CollectionPartitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionPartitionsImpl.class); + + private final CollectionPartitionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionPartitionsImpl( + CollectionPartitionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionUsageImpl(inner1, this.manager())); + } + + private CollectionPartitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java new file mode 100644 index 0000000000000..b7241a0c74bd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsClientImpl.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionRegionsClient. */ +public final class CollectionRegionsClientImpl implements CollectionRegionsClient { + private final ClientLogger logger = new ClientLogger(CollectionRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CollectionRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollectionRegions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java new file mode 100644 index 0000000000000..bce0f7f663369 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionRegionsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.CollectionRegions; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionRegionsImpl implements CollectionRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionRegionsImpl.class); + + private final CollectionRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionRegionsImpl( + CollectionRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, region, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private CollectionRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java new file mode 100644 index 0000000000000..d4928be0e6baa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsClientImpl.java @@ -0,0 +1,813 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CollectionsClient. */ +public final class CollectionsClientImpl implements CollectionsClient { + private final ClientLogger logger = new ClientLogger(CollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CollectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(CollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientCollections to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface CollectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}" + + "/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter)); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + return new PagedIterable<>( + listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, context)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid, collectionRid)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + return new PagedFlux<>( + () -> + listMetricDefinitionsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, context)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return new PagedIterable<>( + listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid)); + } + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + return new PagedIterable<>( + listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java new file mode 100644 index 0000000000000..625c0bf9fb3d8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CollectionsImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.Collections; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CollectionsImpl implements Collections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CollectionsImpl.class); + + private final CollectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public CollectionsImpl( + CollectionsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listUsages(resourceGroupName, accountName, databaseRid, collectionRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetricDefinitions(resourceGroupName, accountName, databaseRid, collectionRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private CollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java new file mode 100644 index 0000000000000..a936318552de4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the CosmosDBManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {CosmosDBManagementClientImpl.class}) +public final class CosmosDBManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the CosmosDBManagementClientBuilder. + */ + public CosmosDBManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CosmosDBManagementClientImpl with the provided parameters. + * + * @return an instance of CosmosDBManagementClientImpl. + */ + public CosmosDBManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + CosmosDBManagementClientImpl client = + new CosmosDBManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java new file mode 100644 index 0000000000000..ed3c60ec16203 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,741 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraClustersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraDataCentersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CassandraResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionPartitionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.CosmosDBManagementClient; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.GraphResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.MongoDBResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.NotebookWorkspacesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.OperationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileSourceTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentilesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbCollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlContainersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.ServicesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the CosmosDBManagementClientImpl type. */ +@ServiceClient(builder = CosmosDBManagementClientBuilder.class) +public final class CosmosDBManagementClientImpl implements CosmosDBManagementClient { + private final ClientLogger logger = new ClientLogger(CosmosDBManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The DatabaseAccountsClient object to access its operations. */ + private final DatabaseAccountsClient databaseAccounts; + + /** + * Gets the DatabaseAccountsClient object to access its operations. + * + * @return the DatabaseAccountsClient object. + */ + public DatabaseAccountsClient getDatabaseAccounts() { + return this.databaseAccounts; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + + /** The CollectionsClient object to access its operations. */ + private final CollectionsClient collections; + + /** + * Gets the CollectionsClient object to access its operations. + * + * @return the CollectionsClient object. + */ + public CollectionsClient getCollections() { + return this.collections; + } + + /** The CollectionRegionsClient object to access its operations. */ + private final CollectionRegionsClient collectionRegions; + + /** + * Gets the CollectionRegionsClient object to access its operations. + * + * @return the CollectionRegionsClient object. + */ + public CollectionRegionsClient getCollectionRegions() { + return this.collectionRegions; + } + + /** The DatabaseAccountRegionsClient object to access its operations. */ + private final DatabaseAccountRegionsClient databaseAccountRegions; + + /** + * Gets the DatabaseAccountRegionsClient object to access its operations. + * + * @return the DatabaseAccountRegionsClient object. + */ + public DatabaseAccountRegionsClient getDatabaseAccountRegions() { + return this.databaseAccountRegions; + } + + /** The PercentileSourceTargetsClient object to access its operations. */ + private final PercentileSourceTargetsClient percentileSourceTargets; + + /** + * Gets the PercentileSourceTargetsClient object to access its operations. + * + * @return the PercentileSourceTargetsClient object. + */ + public PercentileSourceTargetsClient getPercentileSourceTargets() { + return this.percentileSourceTargets; + } + + /** The PercentileTargetsClient object to access its operations. */ + private final PercentileTargetsClient percentileTargets; + + /** + * Gets the PercentileTargetsClient object to access its operations. + * + * @return the PercentileTargetsClient object. + */ + public PercentileTargetsClient getPercentileTargets() { + return this.percentileTargets; + } + + /** The PercentilesClient object to access its operations. */ + private final PercentilesClient percentiles; + + /** + * Gets the PercentilesClient object to access its operations. + * + * @return the PercentilesClient object. + */ + public PercentilesClient getPercentiles() { + return this.percentiles; + } + + /** The CollectionPartitionRegionsClient object to access its operations. */ + private final CollectionPartitionRegionsClient collectionPartitionRegions; + + /** + * Gets the CollectionPartitionRegionsClient object to access its operations. + * + * @return the CollectionPartitionRegionsClient object. + */ + public CollectionPartitionRegionsClient getCollectionPartitionRegions() { + return this.collectionPartitionRegions; + } + + /** The CollectionPartitionsClient object to access its operations. */ + private final CollectionPartitionsClient collectionPartitions; + + /** + * Gets the CollectionPartitionsClient object to access its operations. + * + * @return the CollectionPartitionsClient object. + */ + public CollectionPartitionsClient getCollectionPartitions() { + return this.collectionPartitions; + } + + /** The PartitionKeyRangeIdsClient object to access its operations. */ + private final PartitionKeyRangeIdsClient partitionKeyRangeIds; + + /** + * Gets the PartitionKeyRangeIdsClient object to access its operations. + * + * @return the PartitionKeyRangeIdsClient object. + */ + public PartitionKeyRangeIdsClient getPartitionKeyRangeIds() { + return this.partitionKeyRangeIds; + } + + /** The PartitionKeyRangeIdRegionsClient object to access its operations. */ + private final PartitionKeyRangeIdRegionsClient partitionKeyRangeIdRegions; + + /** + * Gets the PartitionKeyRangeIdRegionsClient object to access its operations. + * + * @return the PartitionKeyRangeIdRegionsClient object. + */ + public PartitionKeyRangeIdRegionsClient getPartitionKeyRangeIdRegions() { + return this.partitionKeyRangeIdRegions; + } + + /** The GraphResourcesClient object to access its operations. */ + private final GraphResourcesClient graphResources; + + /** + * Gets the GraphResourcesClient object to access its operations. + * + * @return the GraphResourcesClient object. + */ + public GraphResourcesClient getGraphResources() { + return this.graphResources; + } + + /** The SqlResourcesClient object to access its operations. */ + private final SqlResourcesClient sqlResources; + + /** + * Gets the SqlResourcesClient object to access its operations. + * + * @return the SqlResourcesClient object. + */ + public SqlResourcesClient getSqlResources() { + return this.sqlResources; + } + + /** The MongoDBResourcesClient object to access its operations. */ + private final MongoDBResourcesClient mongoDBResources; + + /** + * Gets the MongoDBResourcesClient object to access its operations. + * + * @return the MongoDBResourcesClient object. + */ + public MongoDBResourcesClient getMongoDBResources() { + return this.mongoDBResources; + } + + /** The TableResourcesClient object to access its operations. */ + private final TableResourcesClient tableResources; + + /** + * Gets the TableResourcesClient object to access its operations. + * + * @return the TableResourcesClient object. + */ + public TableResourcesClient getTableResources() { + return this.tableResources; + } + + /** The CassandraResourcesClient object to access its operations. */ + private final CassandraResourcesClient cassandraResources; + + /** + * Gets the CassandraResourcesClient object to access its operations. + * + * @return the CassandraResourcesClient object. + */ + public CassandraResourcesClient getCassandraResources() { + return this.cassandraResources; + } + + /** The GremlinResourcesClient object to access its operations. */ + private final GremlinResourcesClient gremlinResources; + + /** + * Gets the GremlinResourcesClient object to access its operations. + * + * @return the GremlinResourcesClient object. + */ + public GremlinResourcesClient getGremlinResources() { + return this.gremlinResources; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The NotebookWorkspacesClient object to access its operations. */ + private final NotebookWorkspacesClient notebookWorkspaces; + + /** + * Gets the NotebookWorkspacesClient object to access its operations. + * + * @return the NotebookWorkspacesClient object. + */ + public NotebookWorkspacesClient getNotebookWorkspaces() { + return this.notebookWorkspaces; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The RestorableDatabaseAccountsClient object to access its operations. */ + private final RestorableDatabaseAccountsClient restorableDatabaseAccounts; + + /** + * Gets the RestorableDatabaseAccountsClient object to access its operations. + * + * @return the RestorableDatabaseAccountsClient object. + */ + public RestorableDatabaseAccountsClient getRestorableDatabaseAccounts() { + return this.restorableDatabaseAccounts; + } + + /** The RestorableSqlDatabasesClient object to access its operations. */ + private final RestorableSqlDatabasesClient restorableSqlDatabases; + + /** + * Gets the RestorableSqlDatabasesClient object to access its operations. + * + * @return the RestorableSqlDatabasesClient object. + */ + public RestorableSqlDatabasesClient getRestorableSqlDatabases() { + return this.restorableSqlDatabases; + } + + /** The RestorableSqlContainersClient object to access its operations. */ + private final RestorableSqlContainersClient restorableSqlContainers; + + /** + * Gets the RestorableSqlContainersClient object to access its operations. + * + * @return the RestorableSqlContainersClient object. + */ + public RestorableSqlContainersClient getRestorableSqlContainers() { + return this.restorableSqlContainers; + } + + /** The RestorableSqlResourcesClient object to access its operations. */ + private final RestorableSqlResourcesClient restorableSqlResources; + + /** + * Gets the RestorableSqlResourcesClient object to access its operations. + * + * @return the RestorableSqlResourcesClient object. + */ + public RestorableSqlResourcesClient getRestorableSqlResources() { + return this.restorableSqlResources; + } + + /** The RestorableMongodbDatabasesClient object to access its operations. */ + private final RestorableMongodbDatabasesClient restorableMongodbDatabases; + + /** + * Gets the RestorableMongodbDatabasesClient object to access its operations. + * + * @return the RestorableMongodbDatabasesClient object. + */ + public RestorableMongodbDatabasesClient getRestorableMongodbDatabases() { + return this.restorableMongodbDatabases; + } + + /** The RestorableMongodbCollectionsClient object to access its operations. */ + private final RestorableMongodbCollectionsClient restorableMongodbCollections; + + /** + * Gets the RestorableMongodbCollectionsClient object to access its operations. + * + * @return the RestorableMongodbCollectionsClient object. + */ + public RestorableMongodbCollectionsClient getRestorableMongodbCollections() { + return this.restorableMongodbCollections; + } + + /** The RestorableMongodbResourcesClient object to access its operations. */ + private final RestorableMongodbResourcesClient restorableMongodbResources; + + /** + * Gets the RestorableMongodbResourcesClient object to access its operations. + * + * @return the RestorableMongodbResourcesClient object. + */ + public RestorableMongodbResourcesClient getRestorableMongodbResources() { + return this.restorableMongodbResources; + } + + /** The CassandraClustersClient object to access its operations. */ + private final CassandraClustersClient cassandraClusters; + + /** + * Gets the CassandraClustersClient object to access its operations. + * + * @return the CassandraClustersClient object. + */ + public CassandraClustersClient getCassandraClusters() { + return this.cassandraClusters; + } + + /** The CassandraDataCentersClient object to access its operations. */ + private final CassandraDataCentersClient cassandraDataCenters; + + /** + * Gets the CassandraDataCentersClient object to access its operations. + * + * @return the CassandraDataCentersClient object. + */ + public CassandraDataCentersClient getCassandraDataCenters() { + return this.cassandraDataCenters; + } + + /** The ServicesClient object to access its operations. */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** + * Initializes an instance of CosmosDBManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + CosmosDBManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-07-01-preview"; + this.databaseAccounts = new DatabaseAccountsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.collections = new CollectionsClientImpl(this); + this.collectionRegions = new CollectionRegionsClientImpl(this); + this.databaseAccountRegions = new DatabaseAccountRegionsClientImpl(this); + this.percentileSourceTargets = new PercentileSourceTargetsClientImpl(this); + this.percentileTargets = new PercentileTargetsClientImpl(this); + this.percentiles = new PercentilesClientImpl(this); + this.collectionPartitionRegions = new CollectionPartitionRegionsClientImpl(this); + this.collectionPartitions = new CollectionPartitionsClientImpl(this); + this.partitionKeyRangeIds = new PartitionKeyRangeIdsClientImpl(this); + this.partitionKeyRangeIdRegions = new PartitionKeyRangeIdRegionsClientImpl(this); + this.graphResources = new GraphResourcesClientImpl(this); + this.sqlResources = new SqlResourcesClientImpl(this); + this.mongoDBResources = new MongoDBResourcesClientImpl(this); + this.tableResources = new TableResourcesClientImpl(this); + this.cassandraResources = new CassandraResourcesClientImpl(this); + this.gremlinResources = new GremlinResourcesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.notebookWorkspaces = new NotebookWorkspacesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.restorableDatabaseAccounts = new RestorableDatabaseAccountsClientImpl(this); + this.restorableSqlDatabases = new RestorableSqlDatabasesClientImpl(this); + this.restorableSqlContainers = new RestorableSqlContainersClientImpl(this); + this.restorableSqlResources = new RestorableSqlResourcesClientImpl(this); + this.restorableMongodbDatabases = new RestorableMongodbDatabasesClientImpl(this); + this.restorableMongodbCollections = new RestorableMongodbCollectionsClientImpl(this); + this.restorableMongodbResources = new RestorableMongodbResourcesClientImpl(this); + this.cassandraClusters = new CassandraClustersClientImpl(this); + this.cassandraDataCenters = new CassandraDataCentersClientImpl(this); + this.services = new ServicesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DataCenterResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DataCenterResourceImpl.java new file mode 100644 index 0000000000000..ff429624f1a47 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DataCenterResourceImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +public final class DataCenterResourceImpl + implements DataCenterResource, DataCenterResource.Definition, DataCenterResource.Update { + private DataCenterResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DataCenterResourceProperties properties() { + return this.innerModel().properties(); + } + + public DataCenterResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private String dataCenterName; + + public DataCenterResourceImpl withExistingCassandraCluster(String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + public DataCenterResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .createUpdate(resourceGroupName, clusterName, dataCenterName, this.innerModel(), Context.NONE); + return this; + } + + public DataCenterResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .createUpdate(resourceGroupName, clusterName, dataCenterName, this.innerModel(), context); + return this; + } + + DataCenterResourceImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new DataCenterResourceInner(); + this.serviceManager = serviceManager; + this.dataCenterName = name; + } + + public DataCenterResourceImpl update() { + return this; + } + + public DataCenterResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .update(resourceGroupName, clusterName, dataCenterName, this.innerModel(), Context.NONE); + return this; + } + + public DataCenterResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .update(resourceGroupName, clusterName, dataCenterName, this.innerModel(), context); + return this; + } + + DataCenterResourceImpl( + DataCenterResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "cassandraClusters"); + this.dataCenterName = Utils.getValueFromIdByName(innerObject.id(), "dataCenters"); + } + + public DataCenterResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .getWithResponse(resourceGroupName, clusterName, dataCenterName, Context.NONE) + .getValue(); + return this; + } + + public DataCenterResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCassandraDataCenters() + .getWithResponse(resourceGroupName, clusterName, dataCenterName, context) + .getValue(); + return this; + } + + public DataCenterResourceImpl withProperties(DataCenterResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java new file mode 100644 index 0000000000000..e09d0570058e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,744 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.Capability; +import com.azure.resourcemanager.cosmos.generated.models.ConnectorOffer; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountOfferType; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class DatabaseAccountGetResultsImpl + implements DatabaseAccountGetResults, DatabaseAccountGetResults.Definition, DatabaseAccountGetResults.Update { + private DatabaseAccountGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public DatabaseAccountKind kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String documentEndpoint() { + return this.innerModel().documentEndpoint(); + } + + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.innerModel().databaseAccountOfferType(); + } + + public List ipRules() { + List inner = this.innerModel().ipRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isVirtualNetworkFilterEnabled() { + return this.innerModel().isVirtualNetworkFilterEnabled(); + } + + public Boolean enableAutomaticFailover() { + return this.innerModel().enableAutomaticFailover(); + } + + public ConsistencyPolicy consistencyPolicy() { + return this.innerModel().consistencyPolicy(); + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List writeLocations() { + List inner = this.innerModel().writeLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List readLocations() { + List inner = this.innerModel().readLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List failoverPolicies() { + List inner = this.innerModel().failoverPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List virtualNetworkRules() { + List inner = this.innerModel().virtualNetworkRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Boolean enableMultipleWriteLocations() { + return this.innerModel().enableMultipleWriteLocations(); + } + + public Boolean enableCassandraConnector() { + return this.innerModel().enableCassandraConnector(); + } + + public ConnectorOffer connectorOffer() { + return this.innerModel().connectorOffer(); + } + + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.innerModel().disableKeyBasedMetadataWriteAccess(); + } + + public String keyVaultKeyUri() { + return this.innerModel().keyVaultKeyUri(); + } + + public String defaultIdentity() { + return this.innerModel().defaultIdentity(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Boolean enableFreeTier() { + return this.innerModel().enableFreeTier(); + } + + public ApiProperties apiProperties() { + return this.innerModel().apiProperties(); + } + + public Boolean enableAnalyticalStorage() { + return this.innerModel().enableAnalyticalStorage(); + } + + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.innerModel().analyticalStorageConfiguration(); + } + + public String instanceId() { + return this.innerModel().instanceId(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public RestoreParameters restoreParameters() { + return this.innerModel().restoreParameters(); + } + + public BackupPolicy backupPolicy() { + return this.innerModel().backupPolicy(); + } + + public List cors() { + List inner = this.innerModel().cors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public NetworkAclBypass networkAclBypass() { + return this.innerModel().networkAclBypass(); + } + + public List networkAclBypassResourceIds() { + List inner = this.innerModel().networkAclBypassResourceIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticLogSettings diagnosticLogSettings() { + return this.innerModel().diagnosticLogSettings(); + } + + public Boolean disableLocalAuth() { + return this.innerModel().disableLocalAuth(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatabaseAccountGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private DatabaseAccountCreateUpdateParameters createCreateUpdateParameters; + + private DatabaseAccountUpdateParameters updateUpdateParameters; + + public DatabaseAccountGetResultsImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DatabaseAccountGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate(resourceGroupName, accountName, createCreateUpdateParameters, Context.NONE); + return this; + } + + public DatabaseAccountGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate(resourceGroupName, accountName, createCreateUpdateParameters, context); + return this; + } + + DatabaseAccountGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new DatabaseAccountGetResultsInner(); + this.serviceManager = serviceManager; + this.accountName = name; + this.createCreateUpdateParameters = new DatabaseAccountCreateUpdateParameters(); + } + + public DatabaseAccountGetResultsImpl update() { + this.updateUpdateParameters = new DatabaseAccountUpdateParameters(); + return this; + } + + public DatabaseAccountGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .update(resourceGroupName, accountName, updateUpdateParameters, Context.NONE); + return this; + } + + public DatabaseAccountGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .update(resourceGroupName, accountName, updateUpdateParameters, context); + return this; + } + + DatabaseAccountGetResultsImpl( + DatabaseAccountGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public DatabaseAccountGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseAccountGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters) { + serviceManager.databaseAccounts().failoverPriorityChange(resourceGroupName, accountName, failoverParameters); + } + + public void failoverPriorityChange(FailoverPolicies failoverParameters, Context context) { + serviceManager + .databaseAccounts() + .failoverPriorityChange(resourceGroupName, accountName, failoverParameters, context); + } + + public DatabaseAccountListKeysResult listKeys() { + return serviceManager.databaseAccounts().listKeys(resourceGroupName, accountName); + } + + public Response listKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listKeysWithResponse(resourceGroupName, accountName, context); + } + + public DatabaseAccountListConnectionStringsResult listConnectionStrings() { + return serviceManager.databaseAccounts().listConnectionStrings(resourceGroupName, accountName); + } + + public Response listConnectionStringsWithResponse(Context context) { + return serviceManager + .databaseAccounts() + .listConnectionStringsWithResponse(resourceGroupName, accountName, context); + } + + public void offlineRegion(RegionForOnlineOffline regionParameterForOffline) { + serviceManager.databaseAccounts().offlineRegion(resourceGroupName, accountName, regionParameterForOffline); + } + + public void offlineRegion(RegionForOnlineOffline regionParameterForOffline, Context context) { + serviceManager + .databaseAccounts() + .offlineRegion(resourceGroupName, accountName, regionParameterForOffline, context); + } + + public void onlineRegion(RegionForOnlineOffline regionParameterForOnline) { + serviceManager.databaseAccounts().onlineRegion(resourceGroupName, accountName, regionParameterForOnline); + } + + public void onlineRegion(RegionForOnlineOffline regionParameterForOnline, Context context) { + serviceManager + .databaseAccounts() + .onlineRegion(resourceGroupName, accountName, regionParameterForOnline, context); + } + + public DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys() { + return serviceManager.databaseAccounts().listReadOnlyKeys(resourceGroupName, accountName); + } + + public Response listReadOnlyKeysWithResponse(Context context) { + return serviceManager.databaseAccounts().listReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + } + + public void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + serviceManager.databaseAccounts().regenerateKey(resourceGroupName, accountName, keyToRegenerate); + } + + public void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate, Context context) { + serviceManager.databaseAccounts().regenerateKey(resourceGroupName, accountName, keyToRegenerate, context); + } + + public DatabaseAccountGetResultsImpl withRegion(Region location) { + this.createCreateUpdateParameters.withLocation(location.toString()); + return this; + } + + public DatabaseAccountGetResultsImpl withRegion(String location) { + this.createCreateUpdateParameters.withLocation(location); + return this; + } + + public DatabaseAccountGetResultsImpl withLocations(List locations) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withLocations(locations); + return this; + } else { + this.updateUpdateParameters.withLocations(locations); + return this; + } + } + + public DatabaseAccountGetResultsImpl withCreateMode(CreateMode createMode) { + this.createCreateUpdateParameters.withCreateMode(createMode); + return this; + } + + public DatabaseAccountGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withTags(tags); + return this; + } else { + this.updateUpdateParameters.withTags(tags); + return this; + } + } + + public DatabaseAccountGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withIdentity(identity); + return this; + } else { + this.updateUpdateParameters.withIdentity(identity); + return this; + } + } + + public DatabaseAccountGetResultsImpl withKind(DatabaseAccountKind kind) { + this.createCreateUpdateParameters.withKind(kind); + return this; + } + + public DatabaseAccountGetResultsImpl withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withConsistencyPolicy(consistencyPolicy); + return this; + } else { + this.updateUpdateParameters.withConsistencyPolicy(consistencyPolicy); + return this; + } + } + + public DatabaseAccountGetResultsImpl withIpRules(List ipRules) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withIpRules(ipRules); + return this; + } else { + this.updateUpdateParameters.withIpRules(ipRules); + return this; + } + } + + public DatabaseAccountGetResultsImpl withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } else { + this.updateUpdateParameters.withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } else { + this.updateUpdateParameters.withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } + } + + public DatabaseAccountGetResultsImpl withCapabilities(List capabilities) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withCapabilities(capabilities); + return this; + } else { + this.updateUpdateParameters.withCapabilities(capabilities); + return this; + } + } + + public DatabaseAccountGetResultsImpl withVirtualNetworkRules(List virtualNetworkRules) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withVirtualNetworkRules(virtualNetworkRules); + return this; + } else { + this.updateUpdateParameters.withVirtualNetworkRules(virtualNetworkRules); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableMultipleWriteLocations(enableMultipleWriteLocations); + return this; + } else { + this.updateUpdateParameters.withEnableMultipleWriteLocations(enableMultipleWriteLocations); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableCassandraConnector(Boolean enableCassandraConnector) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableCassandraConnector(enableCassandraConnector); + return this; + } else { + this.updateUpdateParameters.withEnableCassandraConnector(enableCassandraConnector); + return this; + } + } + + public DatabaseAccountGetResultsImpl withConnectorOffer(ConnectorOffer connectorOffer) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withConnectorOffer(connectorOffer); + return this; + } else { + this.updateUpdateParameters.withConnectorOffer(connectorOffer); + return this; + } + } + + public DatabaseAccountGetResultsImpl withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + if (isInCreateMode()) { + this + .createCreateUpdateParameters + .withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + return this; + } else { + this.updateUpdateParameters.withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + return this; + } + } + + public DatabaseAccountGetResultsImpl withKeyVaultKeyUri(String keyVaultKeyUri) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withKeyVaultKeyUri(keyVaultKeyUri); + return this; + } else { + this.updateUpdateParameters.withKeyVaultKeyUri(keyVaultKeyUri); + return this; + } + } + + public DatabaseAccountGetResultsImpl withDefaultIdentity(String defaultIdentity) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withDefaultIdentity(defaultIdentity); + return this; + } else { + this.updateUpdateParameters.withDefaultIdentity(defaultIdentity); + return this; + } + } + + public DatabaseAccountGetResultsImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateUpdateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableFreeTier(Boolean enableFreeTier) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableFreeTier(enableFreeTier); + return this; + } else { + this.updateUpdateParameters.withEnableFreeTier(enableFreeTier); + return this; + } + } + + public DatabaseAccountGetResultsImpl withApiProperties(ApiProperties apiProperties) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withApiProperties(apiProperties); + return this; + } else { + this.updateUpdateParameters.withApiProperties(apiProperties); + return this; + } + } + + public DatabaseAccountGetResultsImpl withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withEnableAnalyticalStorage(enableAnalyticalStorage); + return this; + } else { + this.updateUpdateParameters.withEnableAnalyticalStorage(enableAnalyticalStorage); + return this; + } + } + + public DatabaseAccountGetResultsImpl withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withAnalyticalStorageConfiguration(analyticalStorageConfiguration); + return this; + } else { + this.updateUpdateParameters.withAnalyticalStorageConfiguration(analyticalStorageConfiguration); + return this; + } + } + + public DatabaseAccountGetResultsImpl withBackupPolicy(BackupPolicy backupPolicy) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withBackupPolicy(backupPolicy); + return this; + } else { + this.updateUpdateParameters.withBackupPolicy(backupPolicy); + return this; + } + } + + public DatabaseAccountGetResultsImpl withCors(List cors) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withCors(cors); + return this; + } else { + this.updateUpdateParameters.withCors(cors); + return this; + } + } + + public DatabaseAccountGetResultsImpl withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withNetworkAclBypass(networkAclBypass); + return this; + } else { + this.updateUpdateParameters.withNetworkAclBypass(networkAclBypass); + return this; + } + } + + public DatabaseAccountGetResultsImpl withNetworkAclBypassResourceIds(List networkAclBypassResourceIds) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withNetworkAclBypassResourceIds(networkAclBypassResourceIds); + return this; + } else { + this.updateUpdateParameters.withNetworkAclBypassResourceIds(networkAclBypassResourceIds); + return this; + } + } + + public DatabaseAccountGetResultsImpl withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withDiagnosticLogSettings(diagnosticLogSettings); + return this; + } else { + this.updateUpdateParameters.withDiagnosticLogSettings(diagnosticLogSettings); + return this; + } + } + + public DatabaseAccountGetResultsImpl withDisableLocalAuth(Boolean disableLocalAuth) { + if (isInCreateMode()) { + this.createCreateUpdateParameters.withDisableLocalAuth(disableLocalAuth); + return this; + } else { + this.updateUpdateParameters.withDisableLocalAuth(disableLocalAuth); + return this; + } + } + + public DatabaseAccountGetResultsImpl withRestoreParameters(RestoreParameters restoreParameters) { + this.createCreateUpdateParameters.withRestoreParameters(restoreParameters); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..aae6831ee85da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListConnectionStringsResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountConnectionString; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import java.util.Collections; +import java.util.List; + +public final class DatabaseAccountListConnectionStringsResultImpl + implements DatabaseAccountListConnectionStringsResult { + private DatabaseAccountListConnectionStringsResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListConnectionStringsResultImpl( + DatabaseAccountListConnectionStringsResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List connectionStrings() { + List inner = this.innerModel().connectionStrings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseAccountListConnectionStringsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java new file mode 100644 index 0000000000000..b7698d1acbe39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListKeysResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; + +public final class DatabaseAccountListKeysResultImpl implements DatabaseAccountListKeysResult { + private DatabaseAccountListKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListKeysResultImpl( + DatabaseAccountListKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public String primaryMasterKey() { + return this.innerModel().primaryMasterKey(); + } + + public String secondaryMasterKey() { + return this.innerModel().secondaryMasterKey(); + } + + public DatabaseAccountListKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java new file mode 100644 index 0000000000000..237c67a6a6171 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; + +public final class DatabaseAccountListReadOnlyKeysResultImpl implements DatabaseAccountListReadOnlyKeysResult { + private DatabaseAccountListReadOnlyKeysResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseAccountListReadOnlyKeysResultImpl( + DatabaseAccountListReadOnlyKeysResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryReadonlyMasterKey() { + return this.innerModel().primaryReadonlyMasterKey(); + } + + public String secondaryReadonlyMasterKey() { + return this.innerModel().secondaryReadonlyMasterKey(); + } + + public DatabaseAccountListReadOnlyKeysResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java new file mode 100644 index 0000000000000..ef6cf7b6cd84f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsClientImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountRegionsClient. */ +public final class DatabaseAccountRegionsClientImpl implements DatabaseAccountRegionsClient { + private final ClientLogger logger = new ClientLogger(DatabaseAccountRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseAccountRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAccountRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAccountRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(DatabaseAccountRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabaseAccountRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabaseAccountRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String region, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String region, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String region, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, region, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String region, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, region, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, region, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, region, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java new file mode 100644 index 0000000000000..5e9dd0ed2dddd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountRegionsImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegions; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseAccountRegionsImpl implements DatabaseAccountRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountRegionsImpl.class); + + private final DatabaseAccountRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabaseAccountRegionsImpl( + DatabaseAccountRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, region, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, region, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + private DatabaseAccountRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..b05f4f35872e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsClientImpl.java @@ -0,0 +1,3974 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountsListResult; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAccountsClient. */ +public final class DatabaseAccountsClientImpl implements DatabaseAccountsClient { + private final ClientLogger logger = new ClientLogger(DatabaseAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabaseAccountsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAccountsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabaseAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabaseAccountsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountUpdateParameters updateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountCreateUpdateParameters createUpdateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/failoverPriorityChange") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failoverPriorityChange( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverPolicies failoverParameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/listConnectionStrings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionStrings( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/offlineRegion") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> offlineRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegionForOnlineOffline regionParameterForOffline, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/onlineRegion") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> onlineRegion( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegionForOnlineOffline regionParameterForOnline, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/readonlykeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getReadOnlyKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/readonlykeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listReadOnlyKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/regenerateKey") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> regenerateKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Head("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") + @ExpectedResponses({200, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameExists( + @HostParam("$host") String endpoint, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the properties of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (updateParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter updateParameters is required and cannot be null.")); + } else { + updateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + updateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (updateParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter updateParameters is required and cannot be null.")); + } else { + updateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + updateParameters, + accept, + context); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseAccountGetResultsInner> beginUpdateAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, updateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + Context.NONE); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseAccountGetResultsInner> beginUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, updateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + context); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters).getSyncPoller(); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> beginUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters, context).getSyncPoller(); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, updateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner update( + String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return updateAsync(resourceGroupName, accountName, updateParameters).block(); + } + + /** + * Updates the properties of 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 updateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner update( + String resourceGroupName, + String accountName, + DatabaseAccountUpdateParameters updateParameters, + Context context) { + return updateAsync(resourceGroupName, accountName, updateParameters, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseAccountGetResultsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, createUpdateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseAccountGetResultsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, createUpdateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseAccountGetResultsInner.class, + DatabaseAccountGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters).getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseAccountGetResultsInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return createOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters).block(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates + * on an account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountGetResultsInner createOrUpdate( + String resourceGroupName, + String accountName, + DatabaseAccountCreateUpdateParameters createUpdateParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, createUpdateParameters, context).block(); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context).getSyncPoller(); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, Context context) { + deleteAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverPriorityChangeWithResponseAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (failoverParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverParameters is required and cannot be null.")); + } else { + failoverParameters.validate(); + } + return FluxUtil + .withContext( + context -> + service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + failoverParameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverPriorityChangeWithResponseAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (failoverParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverParameters is required and cannot be null.")); + } else { + failoverParameters.validate(); + } + context = this.client.mergeContext(context); + return service + .failoverPriorityChange( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + failoverParameters, + context); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + Mono>> mono = + failoverPriorityChangeWithResponseAsync(resourceGroupName, accountName, failoverParameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverPriorityChangeWithResponseAsync(resourceGroupName, accountName, failoverParameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters).getSyncPoller(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context) + .getSyncPoller(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverPriorityChangeAsync( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + return beginFailoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + failoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters).block(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + failoverPriorityChangeAsync(resourceGroupName, accountName, failoverParameters, context).block(); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists the access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName) { + return listKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Lists the connection strings for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the connection strings for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionStringsWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionStrings( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the connection strings for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionStringsAsync( + String resourceGroupName, String accountName) { + return listConnectionStringsWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the connection strings for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListConnectionStringsResultInner listConnectionStrings( + String resourceGroupName, String accountName) { + return listConnectionStringsAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the connection strings for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context) { + return listConnectionStringsWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offlineRegionWithResponseAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOffline == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regionParameterForOffline is required and cannot be null.")); + } else { + regionParameterForOffline.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOffline, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offlineRegionWithResponseAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOffline == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter regionParameterForOffline is required and cannot be null.")); + } else { + regionParameterForOffline.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .offlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOffline, + accept, + context); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginOfflineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + Mono>> mono = + offlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOffline); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginOfflineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + offlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOffline, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline).getSyncPoller(); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOfflineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context) + .getSyncPoller(); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + return beginOfflineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + offlineRegionAsync(resourceGroupName, accountName, regionParameterForOffline).block(); + } + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + offlineRegionAsync(resourceGroupName, accountName, regionParameterForOffline, context).block(); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> onlineRegionWithResponseAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOnline == null) { + return Mono + .error( + new IllegalArgumentException("Parameter regionParameterForOnline is required and cannot be null.")); + } else { + regionParameterForOnline.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOnline, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> onlineRegionWithResponseAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (regionParameterForOnline == null) { + return Mono + .error( + new IllegalArgumentException("Parameter regionParameterForOnline is required and cannot be null.")); + } else { + regionParameterForOnline.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .onlineRegion( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + regionParameterForOnline, + accept, + context); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginOnlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + Mono>> mono = + onlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOnline); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginOnlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + onlineRegionWithResponseAsync(resourceGroupName, accountName, regionParameterForOnline, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline).getSyncPoller(); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginOnlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context) + .getSyncPoller(); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onlineRegionAsync( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono onlineRegionAsync( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + return beginOnlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + onlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline).block(); + } + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void onlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + onlineRegionAsync(resourceGroupName, accountName, regionParameterForOnline, context).block(); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getReadOnlyKeysAsync( + String resourceGroupName, String accountName) { + return getReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName) { + return getReadOnlyKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return getReadOnlyKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReadOnlyKeysWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listReadOnlyKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listReadOnlyKeysAsync( + String resourceGroupName, String accountName) { + return listReadOnlyKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { + return listReadOnlyKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listReadOnlyKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyToRegenerate == null) { + return Mono + .error(new IllegalArgumentException("Parameter keyToRegenerate is required and cannot be null.")); + } else { + keyToRegenerate.validate(); + } + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + keyToRegenerate, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateKeyWithResponseAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (keyToRegenerate == null) { + return Mono + .error(new IllegalArgumentException("Parameter keyToRegenerate is required and cannot be null.")); + } else { + keyToRegenerate.validate(); + } + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + keyToRegenerate, + context); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRegenerateKeyAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + Mono>> mono = + regenerateKeyWithResponseAsync(resourceGroupName, accountName, keyToRegenerate); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRegenerateKeyAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + regenerateKeyWithResponseAsync(resourceGroupName, accountName, keyToRegenerate, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate).getSyncPoller(); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context).getSyncPoller(); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + return beginRegenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + regenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate).block(); + } + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + regenerateKeyAsync(resourceGroupName, accountName, keyToRegenerate, context).block(); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameExistsWithResponseAsync(String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .checkNameExists(this.client.getEndpoint(), accountName, this.client.getApiVersion(), context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameExistsWithResponseAsync(String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service.checkNameExists(this.client.getEndpoint(), accountName, this.client.getApiVersion(), context); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameExistsAsync(String accountName) { + return checkNameExistsWithResponseAsync(accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean checkNameExists(String accountName) { + Boolean value = checkNameExistsAsync(accountName).block(); + if (value != null) { + return value; + } else { + throw logger.logExceptionAsError(new NullPointerException()); + } + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameExistsWithResponse(String accountName, Context context) { + return checkNameExistsWithResponseAsync(accountName, context).block(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName) { + final String filter = null; + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages(String resourceGroupName, String accountName) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java new file mode 100644 index 0000000000000..fbedf19d986a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseAccountsImpl.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListConnectionStringsResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountListReadOnlyKeysResult; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccounts; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabaseAccountsImpl implements DatabaseAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountsImpl.class); + + private final DatabaseAccountsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabaseAccountsImpl( + DatabaseAccountsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatabaseAccountGetResults getByResourceGroup(String resourceGroupName, String accountName) { + DatabaseAccountGetResultsInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public void delete(String resourceGroupName, String accountName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, context); + } + + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters) { + this.serviceClient().failoverPriorityChange(resourceGroupName, accountName, failoverParameters); + } + + public void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context) { + this.serviceClient().failoverPriorityChange(resourceGroupName, accountName, failoverParameters, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseAccountGetResultsImpl(inner1, this.manager())); + } + + public DatabaseAccountListKeysResult listKeys(String resourceGroupName, String accountName) { + DatabaseAccountListKeysResultInner inner = this.serviceClient().listKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAccountListConnectionStringsResult listConnectionStrings( + String resourceGroupName, String accountName) { + DatabaseAccountListConnectionStringsResultInner inner = + this.serviceClient().listConnectionStrings(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListConnectionStringsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listConnectionStringsWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListConnectionStringsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void offlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline) { + this.serviceClient().offlineRegion(resourceGroupName, accountName, regionParameterForOffline); + } + + public void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context) { + this.serviceClient().offlineRegion(resourceGroupName, accountName, regionParameterForOffline, context); + } + + public void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline) { + this.serviceClient().onlineRegion(resourceGroupName, accountName, regionParameterForOnline); + } + + public void onlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOnline, + Context context) { + this.serviceClient().onlineRegion(resourceGroupName, accountName, regionParameterForOnline, context); + } + + public DatabaseAccountListReadOnlyKeysResult getReadOnlyKeys(String resourceGroupName, String accountName) { + DatabaseAccountListReadOnlyKeysResultInner inner = + this.serviceClient().getReadOnlyKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListReadOnlyKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(String resourceGroupName, String accountName) { + DatabaseAccountListReadOnlyKeysResultInner inner = + this.serviceClient().listReadOnlyKeys(resourceGroupName, accountName); + if (inner != null) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listReadOnlyKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAccountListReadOnlyKeysResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate) { + this.serviceClient().regenerateKey(resourceGroupName, accountName, keyToRegenerate); + } + + public void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context) { + this.serviceClient().regenerateKey(resourceGroupName, accountName, keyToRegenerate, context); + } + + public boolean checkNameExists(String accountName) { + return this.serviceClient().checkNameExists(accountName); + } + + public Response checkNameExistsWithResponse(String accountName, Context context) { + return this.serviceClient().checkNameExistsWithResponse(accountName, context); + } + + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + PagedIterable inner = this.serviceClient().listMetrics(resourceGroupName, accountName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public DatabaseAccountGetResults getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private DatabaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public DatabaseAccountGetResultsImpl define(String name) { + return new DatabaseAccountGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java new file mode 100644 index 0000000000000..7814f48bb38dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabaseRestoreResourceImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import java.util.Collections; +import java.util.List; + +public final class DatabaseRestoreResourceImpl implements DatabaseRestoreResource { + private DatabaseRestoreResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + DatabaseRestoreResourceImpl( + DatabaseRestoreResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public List collectionNames() { + List inner = this.innerModel().collectionNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatabaseRestoreResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java new file mode 100644 index 0000000000000..d79fa1930b9f1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,720 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinitionsListResult; +import com.azure.resourcemanager.cosmos.generated.models.MetricListResult; +import com.azure.resourcemanager.cosmos.generated.models.UsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + private final ClientLogger logger = new ClientLogger(DatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientDatabases to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsagesSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String filter) { + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync(String resourceGroupName, String accountName, String databaseRid) { + final String filter = null; + return new PagedFlux<>(() -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsagesAsync( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedFlux<>( + () -> listUsagesSinglePageAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + final String filter = null; + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, filter)); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + return new PagedIterable<>(listUsagesAsync(resourceGroupName, accountName, databaseRid, filter, context)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String accountName, String databaseRid, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, accountName, databaseRid, context)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid)); + } + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..b8dbad9c42b86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/DatabasesImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.Databases; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabasesImpl implements Databases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public DatabasesImpl( + DatabasesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listUsages(resourceGroupName, accountName, databaseRid, filter, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, accountName, databaseRid, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourceGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourceGetResultsImpl.java new file mode 100644 index 0000000000000..af746325807c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourceGetResultsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResource; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class GraphResourceGetResultsImpl + implements GraphResourceGetResults, GraphResourceGetResults.Definition, GraphResourceGetResults.Update { + private GraphResourceGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public GraphResourceGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public GraphResourceGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GraphResourceGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String graphName; + + private GraphResourceCreateUpdateParameters createCreateUpdateGraphParameters; + + private GraphResourceCreateUpdateParameters updateCreateUpdateGraphParameters; + + public GraphResourceGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public GraphResourceGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .createUpdateGraph( + resourceGroupName, accountName, graphName, createCreateUpdateGraphParameters, Context.NONE); + return this; + } + + public GraphResourceGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .createUpdateGraph( + resourceGroupName, accountName, graphName, createCreateUpdateGraphParameters, context); + return this; + } + + GraphResourceGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new GraphResourceGetResultsInner(); + this.serviceManager = serviceManager; + this.graphName = name; + this.createCreateUpdateGraphParameters = new GraphResourceCreateUpdateParameters(); + } + + public GraphResourceGetResultsImpl update() { + this.updateCreateUpdateGraphParameters = new GraphResourceCreateUpdateParameters(); + return this; + } + + public GraphResourceGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .createUpdateGraph( + resourceGroupName, accountName, graphName, updateCreateUpdateGraphParameters, Context.NONE); + return this; + } + + public GraphResourceGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .createUpdateGraph( + resourceGroupName, accountName, graphName, updateCreateUpdateGraphParameters, context); + return this; + } + + GraphResourceGetResultsImpl( + GraphResourceGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.graphName = Utils.getValueFromIdByName(innerObject.id(), "graphs"); + } + + public GraphResourceGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .getGraphWithResponse(resourceGroupName, accountName, graphName, Context.NONE) + .getValue(); + return this; + } + + public GraphResourceGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGraphResources() + .getGraphWithResponse(resourceGroupName, accountName, graphName, context) + .getValue(); + return this; + } + + public GraphResourceGetResultsImpl withRegion(Region location) { + this.createCreateUpdateGraphParameters.withLocation(location.toString()); + return this; + } + + public GraphResourceGetResultsImpl withRegion(String location) { + this.createCreateUpdateGraphParameters.withLocation(location); + return this; + } + + public GraphResourceGetResultsImpl withResource(GraphResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateGraphParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateGraphParameters.withResource(resource); + return this; + } + } + + public GraphResourceGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateGraphParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateGraphParameters.withTags(tags); + return this; + } + } + + public GraphResourceGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateGraphParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateGraphParameters.withIdentity(identity); + return this; + } + } + + public GraphResourceGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateGraphParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateGraphParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesClientImpl.java new file mode 100644 index 0000000000000..b5092baf68cab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesClientImpl.java @@ -0,0 +1,1049 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.GraphResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourcesListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GraphResourcesClient. */ +public final class GraphResourcesClientImpl implements GraphResourcesClient { + private final ClientLogger logger = new ClientLogger(GraphResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GraphResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of GraphResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GraphResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(GraphResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientGraphResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface GraphResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/graphs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGraphs( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/graphs/{graphName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/graphs/{graphName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GraphResourceCreateUpdateParameters createUpdateGraphParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/graphs/{graphName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteGraphResource( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Lists the graphs 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGraphsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the graphs 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGraphsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the graphs 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGraphsAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listGraphsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the graphs 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGraphsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listGraphsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the graphs 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGraphs(String resourceGroupName, String accountName) { + return new PagedIterable<>(listGraphsAsync(resourceGroupName, accountName)); + } + + /** + * Lists the graphs 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGraphs( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listGraphsAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGraphWithResponseAsync( + String resourceGroupName, String accountName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGraphWithResponseAsync( + String resourceGroupName, String accountName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGraphAsync( + String resourceGroupName, String accountName, String graphName) { + return getGraphWithResponseAsync(resourceGroupName, accountName, graphName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GraphResourceGetResultsInner getGraph(String resourceGroupName, String accountName, String graphName) { + return getGraphAsync(resourceGroupName, accountName, graphName).block(); + } + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGraphWithResponse( + String resourceGroupName, String accountName, String graphName, Context context) { + return getGraphWithResponseAsync(resourceGroupName, accountName, graphName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGraphParameters is required and cannot be null.")); + } else { + createUpdateGraphParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + createUpdateGraphParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGraphParameters is required and cannot be null.")); + } else { + createUpdateGraphParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + createUpdateGraphParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GraphResourceGetResultsInner> + beginCreateUpdateGraphAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters) { + Mono>> mono = + createUpdateGraphWithResponseAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GraphResourceGetResultsInner.class, + GraphResourceGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GraphResourceGetResultsInner> + beginCreateUpdateGraphAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateGraphWithResponseAsync( + resourceGroupName, accountName, graphName, createUpdateGraphParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GraphResourceGetResultsInner.class, + GraphResourceGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GraphResourceGetResultsInner> beginCreateUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters) { + return beginCreateUpdateGraphAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GraphResourceGetResultsInner> beginCreateUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context) { + return beginCreateUpdateGraphAsync( + resourceGroupName, accountName, graphName, createUpdateGraphParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGraphAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters) { + return beginCreateUpdateGraphAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGraphAsync( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context) { + return beginCreateUpdateGraphAsync( + resourceGroupName, accountName, graphName, createUpdateGraphParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GraphResourceGetResultsInner createUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters) { + return createUpdateGraphAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters).block(); + } + + /** + * Create or update an Azure Cosmos DB Graph. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param createUpdateGraphParameters The parameters to provide for the current graph. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Graph resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GraphResourceGetResultsInner createUpdateGraph( + String resourceGroupName, + String accountName, + String graphName, + GraphResourceCreateUpdateParameters createUpdateGraphParameters, + Context context) { + return createUpdateGraphAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGraphResourceWithResponseAsync( + String resourceGroupName, String accountName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteGraphResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGraphResourceWithResponseAsync( + String resourceGroupName, String accountName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteGraphResource( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + graphName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGraphResourceAsync( + String resourceGroupName, String accountName, String graphName) { + Mono>> mono = + deleteGraphResourceWithResponseAsync(resourceGroupName, accountName, graphName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGraphResourceAsync( + String resourceGroupName, String accountName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteGraphResourceWithResponseAsync(resourceGroupName, accountName, graphName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGraphResource( + String resourceGroupName, String accountName, String graphName) { + return beginDeleteGraphResourceAsync(resourceGroupName, accountName, graphName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGraphResource( + String resourceGroupName, String accountName, String graphName, Context context) { + return beginDeleteGraphResourceAsync(resourceGroupName, accountName, graphName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGraphResourceAsync(String resourceGroupName, String accountName, String graphName) { + return beginDeleteGraphResourceAsync(resourceGroupName, accountName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGraphResourceAsync( + String resourceGroupName, String accountName, String graphName, Context context) { + return beginDeleteGraphResourceAsync(resourceGroupName, accountName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGraphResource(String resourceGroupName, String accountName, String graphName) { + deleteGraphResourceAsync(resourceGroupName, accountName, graphName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGraphResource(String resourceGroupName, String accountName, String graphName, Context context) { + deleteGraphResourceAsync(resourceGroupName, accountName, graphName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesImpl.java new file mode 100644 index 0000000000000..668c43a9beb6a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GraphResourcesImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.GraphResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GraphResourceGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GraphResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GraphResourcesImpl implements GraphResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourcesImpl.class); + + private final GraphResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public GraphResourcesImpl( + GraphResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listGraphs(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listGraphs(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new GraphResourceGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGraphs( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listGraphs(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new GraphResourceGetResultsImpl(inner1, this.manager())); + } + + public GraphResourceGetResults getGraph(String resourceGroupName, String accountName, String graphName) { + GraphResourceGetResultsInner inner = this.serviceClient().getGraph(resourceGroupName, accountName, graphName); + if (inner != null) { + return new GraphResourceGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGraphWithResponse( + String resourceGroupName, String accountName, String graphName, Context context) { + Response inner = + this.serviceClient().getGraphWithResponse(resourceGroupName, accountName, graphName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GraphResourceGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteGraphResource(String resourceGroupName, String accountName, String graphName) { + this.serviceClient().deleteGraphResource(resourceGroupName, accountName, graphName); + } + + public void deleteGraphResource(String resourceGroupName, String accountName, String graphName, Context context) { + this.serviceClient().deleteGraphResource(resourceGroupName, accountName, graphName, context); + } + + public GraphResourceGetResults getGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this.getGraphWithResponse(resourceGroupName, accountName, graphName, Context.NONE).getValue(); + } + + public Response getGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this.getGraphWithResponse(resourceGroupName, accountName, graphName, context); + } + + public void deleteGraphResourceById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGraphResource(resourceGroupName, accountName, graphName, Context.NONE); + } + + public void deleteGraphResourceByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGraphResource(resourceGroupName, accountName, graphName, context); + } + + private GraphResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public GraphResourceGetResultsImpl define(String name) { + return new GraphResourceGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..aa71d9e8c41b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinDatabaseGetResultsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class GremlinDatabaseGetResultsImpl + implements GremlinDatabaseGetResults, GremlinDatabaseGetResults.Definition, GremlinDatabaseGetResults.Update { + private GremlinDatabaseGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public GremlinDatabaseGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public GremlinDatabaseGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GremlinDatabaseGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private GremlinDatabaseCreateUpdateParameters createCreateUpdateGremlinDatabaseParameters; + + private GremlinDatabaseCreateUpdateParameters updateCreateUpdateGremlinDatabaseParameters; + + public GremlinDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public GremlinDatabaseGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinDatabase( + resourceGroupName, + accountName, + databaseName, + createCreateUpdateGremlinDatabaseParameters, + Context.NONE); + return this; + } + + public GremlinDatabaseGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinDatabase( + resourceGroupName, accountName, databaseName, createCreateUpdateGremlinDatabaseParameters, context); + return this; + } + + GremlinDatabaseGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new GremlinDatabaseGetResultsInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + this.createCreateUpdateGremlinDatabaseParameters = new GremlinDatabaseCreateUpdateParameters(); + } + + public GremlinDatabaseGetResultsImpl update() { + this.updateCreateUpdateGremlinDatabaseParameters = new GremlinDatabaseCreateUpdateParameters(); + return this; + } + + public GremlinDatabaseGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinDatabase( + resourceGroupName, + accountName, + databaseName, + updateCreateUpdateGremlinDatabaseParameters, + Context.NONE); + return this; + } + + public GremlinDatabaseGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinDatabase( + resourceGroupName, accountName, databaseName, updateCreateUpdateGremlinDatabaseParameters, context); + return this; + } + + GremlinDatabaseGetResultsImpl( + GremlinDatabaseGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + } + + public GremlinDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public GremlinDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public GremlinDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateGremlinDatabaseParameters.withLocation(location.toString()); + return this; + } + + public GremlinDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateGremlinDatabaseParameters.withLocation(location); + return this; + } + + public GremlinDatabaseGetResultsImpl withResource(GremlinDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withResource(resource); + return this; + } + } + + public GremlinDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withTags(tags); + return this; + } + } + + public GremlinDatabaseGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withIdentity(identity); + return this; + } + } + + public GremlinDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinDatabaseParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateGremlinDatabaseParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java new file mode 100644 index 0000000000000..2e45964f81666 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinGraphGetResultsImpl.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class GremlinGraphGetResultsImpl + implements GremlinGraphGetResults, GremlinGraphGetResults.Definition, GremlinGraphGetResults.Update { + private GremlinGraphGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public GremlinGraphGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public GremlinGraphGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GremlinGraphGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String graphName; + + private GremlinGraphCreateUpdateParameters createCreateUpdateGremlinGraphParameters; + + private GremlinGraphCreateUpdateParameters updateCreateUpdateGremlinGraphParameters; + + public GremlinGraphGetResultsImpl withExistingGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public GremlinGraphGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + createCreateUpdateGremlinGraphParameters, + Context.NONE); + return this; + } + + public GremlinGraphGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + createCreateUpdateGremlinGraphParameters, + context); + return this; + } + + GremlinGraphGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new GremlinGraphGetResultsInner(); + this.serviceManager = serviceManager; + this.graphName = name; + this.createCreateUpdateGremlinGraphParameters = new GremlinGraphCreateUpdateParameters(); + } + + public GremlinGraphGetResultsImpl update() { + this.updateCreateUpdateGremlinGraphParameters = new GremlinGraphCreateUpdateParameters(); + return this; + } + + public GremlinGraphGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + updateCreateUpdateGremlinGraphParameters, + Context.NONE); + return this; + } + + public GremlinGraphGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + resourceGroupName, + accountName, + databaseName, + graphName, + updateCreateUpdateGremlinGraphParameters, + context); + return this; + } + + GremlinGraphGetResultsImpl( + GremlinGraphGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "gremlinDatabases"); + this.graphName = Utils.getValueFromIdByName(innerObject.id(), "graphs"); + } + + public GremlinGraphGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + return this; + } + + public GremlinGraphGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context) + .getValue(); + return this; + } + + public GremlinGraphGetResultsImpl withRegion(Region location) { + this.createCreateUpdateGremlinGraphParameters.withLocation(location.toString()); + return this; + } + + public GremlinGraphGetResultsImpl withRegion(String location) { + this.createCreateUpdateGremlinGraphParameters.withLocation(location); + return this; + } + + public GremlinGraphGetResultsImpl withResource(GremlinGraphResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withResource(resource); + return this; + } + } + + public GremlinGraphGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withTags(tags); + return this; + } + } + + public GremlinGraphGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withIdentity(identity); + return this; + } + } + + public GremlinGraphGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateGremlinGraphParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateGremlinGraphParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java new file mode 100644 index 0000000000000..7314bc4137a86 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesClientImpl.java @@ -0,0 +1,4502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GremlinResourcesClient. */ +public final class GremlinResourcesClientImpl implements GremlinResourcesClient { + private final ClientLogger logger = new ClientLogger(GremlinResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GremlinResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of GremlinResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GremlinResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(GremlinResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientGremlinResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface GremlinResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGremlinDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteGremlinDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateGremlinDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGremlinGraphs( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteGremlinGraph( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getGremlinGraphThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateGremlinGraphThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinGraphToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateGremlinGraphToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("graphName") String graphName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinDatabasesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listGremlinDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listGremlinDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listGremlinDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listGremlinDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateGremlinDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinDatabaseParameters is required and cannot be null.")); + } else { + createUpdateGremlinDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateGremlinDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateGremlinDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinDatabaseParameters is required and cannot be null.")); + } else { + createUpdateGremlinDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateGremlinDatabaseParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + Mono>> mono = + createUpdateGremlinDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinDatabaseGetResultsInner.class, + GremlinDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateGremlinDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinDatabaseGetResultsInner.class, + GremlinDatabaseGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GremlinDatabaseGetResultsInner> + beginCreateUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return beginCreateUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return createUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @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 createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinDatabaseGetResultsInner createUpdateGremlinDatabase( + String resourceGroupName, + String accountName, + String databaseName, + GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, + Context context) { + return createUpdateGremlinDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteGremlinDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteGremlinDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + deleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the Gremlin database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the Gremlin database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the Gremlin database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the Gremlin database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the Gremlin database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getGremlinDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateGremlinDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateGremlinDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateGremlinDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateGremlinDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateGremlinDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateGremlinDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateGremlinDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinGraphsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGremlinGraphsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listGremlinGraphs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinGraphsAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>(() -> listGremlinGraphsSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listGremlinGraphsAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listGremlinGraphsSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listGremlinGraphsAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the graphs and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listGremlinGraphsAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return getGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGremlinGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinGraphParameters is required and cannot be null.")); + } else { + createUpdateGremlinGraphParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + createUpdateGremlinGraphParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateGremlinGraphWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (createUpdateGremlinGraphParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateGremlinGraphParameters is required and cannot be null.")); + } else { + createUpdateGremlinGraphParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + createUpdateGremlinGraphParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + Mono>> mono = + createUpdateGremlinGraphWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinGraphGetResultsInner.class, + GremlinGraphGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateGremlinGraphWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GremlinGraphGetResultsInner.class, + GremlinGraphGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GremlinGraphGetResultsInner> + beginCreateUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateGremlinGraphAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return beginCreateUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Gremlin graph. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GremlinGraphGetResultsInner createUpdateGremlinGraph( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, + Context context) { + return createUpdateGremlinGraphAsync( + resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteGremlinGraphWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteGremlinGraph( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + deleteGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteGremlinGraphWithResponseAsync(resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteGremlinGraphAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginDeleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + deleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + deleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getGremlinGraphThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return getGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateGremlinGraphThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateGremlinGraphThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateGremlinGraphThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateGremlinGraphThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateGremlinGraphThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + migrateGremlinGraphToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinGraphToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToAutoscaleAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToAutoscaleAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return migrateGremlinGraphToAutoscaleAsync(resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateGremlinGraphToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (graphName == null) { + return Mono.error(new IllegalArgumentException("Parameter graphName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateGremlinGraphToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + graphName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + Mono>> mono = + migrateGremlinGraphToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateGremlinGraphToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, graphName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginMigrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateGremlinGraphToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return beginMigrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + return migrateGremlinGraphToManualThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + return migrateGremlinGraphToManualThroughputAsync( + resourceGroupName, accountName, databaseName, graphName, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java new file mode 100644 index 0000000000000..cf1ac30d1f523 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/GremlinResourcesImpl.java @@ -0,0 +1,653 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.GremlinResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphGetResults; +import com.azure.resourcemanager.cosmos.generated.models.GremlinResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GremlinResourcesImpl implements GremlinResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinResourcesImpl.class); + + private final GremlinResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public GremlinResourcesImpl( + GremlinResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listGremlinDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new GremlinDatabaseGetResultsImpl(inner1, this.manager())); + } + + public GremlinDatabaseGetResults getGremlinDatabase( + String resourceGroupName, String accountName, String databaseName) { + GremlinDatabaseGetResultsInner inner = + this.serviceClient().getGremlinDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new GremlinDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GremlinDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteGremlinDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteGremlinDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteGremlinDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getGremlinDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateGremlinDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateGremlinDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listGremlinGraphs(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listGremlinGraphs(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new GremlinGraphGetResultsImpl(inner1, this.manager())); + } + + public GremlinGraphGetResults getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinGraphGetResultsInner inner = + this.serviceClient().getGremlinGraph(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new GremlinGraphGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GremlinGraphGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName) { + this.serviceClient().deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName); + } + + public void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + this.serviceClient().deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, context); + } + + public ThroughputSettingsGetResults getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getGremlinGraphThroughput(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + Response inner = + this + .serviceClient() + .getGremlinGraphThroughputWithResponse( + resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinGraphThroughput( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateGremlinGraphThroughput( + resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToAutoscale(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToAutoscale(resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToManualThroughput(resourceGroupName, accountName, databaseName, graphName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateGremlinGraphToManualThroughput( + resourceGroupName, accountName, databaseName, graphName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public GremlinDatabaseGetResults getGremlinDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this + .getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + return this.getGremlinDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public GremlinGraphGetResults getGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this + .getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, Context.NONE) + .getValue(); + } + + public Response getGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + return this.getGremlinGraphWithResponse(resourceGroupName, accountName, databaseName, graphName, context); + } + + public void deleteGremlinDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteGremlinDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + this.deleteGremlinDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteGremlinGraphById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, Context.NONE); + } + + public void deleteGremlinGraphByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "gremlinDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'gremlinDatabases'.", id))); + } + String graphName = Utils.getValueFromIdByName(id, "graphs"); + if (graphName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'graphs'.", id))); + } + this.deleteGremlinGraph(resourceGroupName, accountName, databaseName, graphName, context); + } + + private GremlinResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public GremlinDatabaseGetResultsImpl defineUpdateGremlinDatabase(String name) { + return new GremlinDatabaseGetResultsImpl(name, this.manager()); + } + + public GremlinGraphGetResultsImpl defineUpdateGremlinGraph(String name) { + return new GremlinGraphGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java new file mode 100644 index 0000000000000..19035aed67192 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/LocationGetResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.LocationGetResult; +import com.azure.resourcemanager.cosmos.generated.models.LocationProperties; + +public final class LocationGetResultImpl implements LocationGetResult { + private LocationGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + LocationGetResultImpl( + LocationGetResultInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public LocationProperties properties() { + return this.innerModel().properties(); + } + + public LocationGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricDefinitionImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricDefinitionImpl.java new file mode 100644 index 0000000000000..3c7cc72920796 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricDefinitionImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricAvailability; +import com.azure.resourcemanager.cosmos.generated.models.MetricDefinition; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.util.Collections; +import java.util.List; + +public final class MetricDefinitionImpl implements MetricDefinition { + private MetricDefinitionInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + MetricDefinitionImpl( + MetricDefinitionInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List metricAvailabilities() { + List inner = this.innerModel().metricAvailabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrimaryAggregationType primaryAggregationType() { + return this.innerModel().primaryAggregationType(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public String resourceUri() { + return this.innerModel().resourceUri(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public MetricDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java new file mode 100644 index 0000000000000..5bc3bfac4391f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MetricImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.cosmos.generated.models.Metric; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class MetricImpl implements Metric { + private MetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + MetricImpl(MetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java new file mode 100644 index 0000000000000..f4655413e946c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBCollectionGetResultsImpl.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import java.util.Collections; +import java.util.Map; + +public final class MongoDBCollectionGetResultsImpl + implements MongoDBCollectionGetResults, MongoDBCollectionGetResults.Definition, MongoDBCollectionGetResults.Update { + private MongoDBCollectionGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public MongoDBCollectionGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public MongoDBCollectionGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public MongoDBCollectionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String collectionName; + + private MongoDBCollectionCreateUpdateParameters createCreateUpdateMongoDBCollectionParameters; + + private MongoDBCollectionCreateUpdateParameters updateCreateUpdateMongoDBCollectionParameters; + + public MongoDBCollectionGetResultsImpl withExistingMongodbDatabase( + String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public MongoDBCollectionGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + createCreateUpdateMongoDBCollectionParameters, + Context.NONE); + return this; + } + + public MongoDBCollectionGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + createCreateUpdateMongoDBCollectionParameters, + context); + return this; + } + + MongoDBCollectionGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new MongoDBCollectionGetResultsInner(); + this.serviceManager = serviceManager; + this.collectionName = name; + this.createCreateUpdateMongoDBCollectionParameters = new MongoDBCollectionCreateUpdateParameters(); + } + + public MongoDBCollectionGetResultsImpl update() { + this.updateCreateUpdateMongoDBCollectionParameters = new MongoDBCollectionCreateUpdateParameters(); + return this; + } + + public MongoDBCollectionGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + updateCreateUpdateMongoDBCollectionParameters, + Context.NONE); + return this; + } + + public MongoDBCollectionGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + resourceGroupName, + accountName, + databaseName, + collectionName, + updateCreateUpdateMongoDBCollectionParameters, + context); + return this; + } + + MongoDBCollectionGetResultsImpl( + MongoDBCollectionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + this.collectionName = Utils.getValueFromIdByName(innerObject.id(), "collections"); + } + + public MongoDBCollectionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + return this; + } + + public MongoDBCollectionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context) + .getValue(); + return this; + } + + public MongoDBCollectionGetResultsImpl withRegion(Region location) { + this.createCreateUpdateMongoDBCollectionParameters.withLocation(location.toString()); + return this; + } + + public MongoDBCollectionGetResultsImpl withRegion(String location) { + this.createCreateUpdateMongoDBCollectionParameters.withLocation(location); + return this; + } + + public MongoDBCollectionGetResultsImpl withResource(MongoDBCollectionResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withResource(resource); + return this; + } + } + + public MongoDBCollectionGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withTags(tags); + return this; + } + } + + public MongoDBCollectionGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withIdentity(identity); + return this; + } + } + + public MongoDBCollectionGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBCollectionParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateMongoDBCollectionParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..ad98d65007d8a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBDatabaseGetResultsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.util.Collections; +import java.util.Map; + +public final class MongoDBDatabaseGetResultsImpl + implements MongoDBDatabaseGetResults, MongoDBDatabaseGetResults.Definition, MongoDBDatabaseGetResults.Update { + private MongoDBDatabaseGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public MongoDBDatabaseGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public MongoDBDatabaseGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public MongoDBDatabaseGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private MongoDBDatabaseCreateUpdateParameters createCreateUpdateMongoDBDatabaseParameters; + + private MongoDBDatabaseCreateUpdateParameters updateCreateUpdateMongoDBDatabaseParameters; + + public MongoDBDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public MongoDBDatabaseGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBDatabase( + resourceGroupName, + accountName, + databaseName, + createCreateUpdateMongoDBDatabaseParameters, + Context.NONE); + return this; + } + + public MongoDBDatabaseGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBDatabase( + resourceGroupName, accountName, databaseName, createCreateUpdateMongoDBDatabaseParameters, context); + return this; + } + + MongoDBDatabaseGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new MongoDBDatabaseGetResultsInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + this.createCreateUpdateMongoDBDatabaseParameters = new MongoDBDatabaseCreateUpdateParameters(); + } + + public MongoDBDatabaseGetResultsImpl update() { + this.updateCreateUpdateMongoDBDatabaseParameters = new MongoDBDatabaseCreateUpdateParameters(); + return this; + } + + public MongoDBDatabaseGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBDatabase( + resourceGroupName, + accountName, + databaseName, + updateCreateUpdateMongoDBDatabaseParameters, + Context.NONE); + return this; + } + + public MongoDBDatabaseGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBDatabase( + resourceGroupName, accountName, databaseName, updateCreateUpdateMongoDBDatabaseParameters, context); + return this; + } + + MongoDBDatabaseGetResultsImpl( + MongoDBDatabaseGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "mongodbDatabases"); + } + + public MongoDBDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public MongoDBDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public MongoDBDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateMongoDBDatabaseParameters.withLocation(location.toString()); + return this; + } + + public MongoDBDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateMongoDBDatabaseParameters.withLocation(location); + return this; + } + + public MongoDBDatabaseGetResultsImpl withResource(MongoDBDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withResource(resource); + return this; + } + } + + public MongoDBDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withTags(tags); + return this; + } + } + + public MongoDBDatabaseGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withIdentity(identity); + return this; + } + } + + public MongoDBDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateMongoDBDatabaseParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateMongoDBDatabaseParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java new file mode 100644 index 0000000000000..c6d8a85be841a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesClientImpl.java @@ -0,0 +1,4557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.MongoDBResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionListResult; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MongoDBResourcesClient. */ +public final class MongoDBResourcesClientImpl implements MongoDBResourcesClient { + private final ClientLogger logger = new ClientLogger(MongoDBResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MongoDBResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of MongoDBResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MongoDBResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(MongoDBResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientMongoDBResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface MongoDBResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoDBDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoDBDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateMongoDBDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMongoDBCollections( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMongoDBCollection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMongoDBCollectionThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateMongoDBCollectionThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBCollectionToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateMongoDBCollectionToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("collectionName") String collectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBDatabasesAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listMongoDBDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listMongoDBDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listMongoDBDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listMongoDBDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateMongoDBDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null.")); + } else { + createUpdateMongoDBDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateMongoDBDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateMongoDBDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null.")); + } else { + createUpdateMongoDBDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateMongoDBDatabaseParameters, + accept, + context); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + Mono>> mono = + createUpdateMongoDBDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBDatabaseGetResultsInner.class, + MongoDBDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateMongoDBDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBDatabaseGetResultsInner.class, + MongoDBDatabaseGetResultsInner.class, + context); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoDBDatabaseGetResultsInner> + beginCreateUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return beginCreateUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return createUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) + .block(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @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 createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase( + String resourceGroupName, + String accountName, + String databaseName, + MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, + Context context) { + return createUpdateMongoDBDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteMongoDBDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteMongoDBDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + deleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the MongoDB database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the MongoDB database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the MongoDB database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the MongoDB database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getMongoDBDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateMongoDBDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateMongoDBDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateMongoDBDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateMongoDBDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateMongoDBDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateMongoDBDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateMongoDBDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBCollectionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMongoDBCollectionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMongoDBCollections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBCollectionsAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>( + () -> listMongoDBCollectionsSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMongoDBCollectionsAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listMongoDBCollectionsSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithResponseAsync(resourceGroupName, accountName, databaseName, collectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return getMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBCollectionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (createUpdateMongoDBCollectionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBCollectionParameters is required and cannot be null.")); + } else { + createUpdateMongoDBCollectionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + createUpdateMongoDBCollectionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateMongoDBCollectionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (createUpdateMongoDBCollectionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateMongoDBCollectionParameters is required and cannot be null.")); + } else { + createUpdateMongoDBCollectionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + createUpdateMongoDBCollectionParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + Mono>> mono = + createUpdateMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBCollectionGetResultsInner.class, + MongoDBCollectionGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateMongoDBCollectionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MongoDBCollectionGetResultsInner.class, + MongoDBCollectionGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoDBCollectionGetResultsInner> + beginCreateUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateMongoDBCollectionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return beginCreateUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionAsync( + resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB MongoDB collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, + Context context) { + return createUpdateMongoDBCollectionAsync( + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMongoDBCollectionWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteMongoDBCollection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + deleteMongoDBCollectionWithResponseAsync(resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteMongoDBCollectionWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMongoDBCollectionAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginDeleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + deleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + deleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMongoDBCollectionThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return getMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateMongoDBCollectionThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateMongoDBCollectionThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateMongoDBCollectionThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateMongoDBCollectionThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateMongoDBCollectionThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + migrateMongoDBCollectionToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBCollectionToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateMongoDBCollectionToAutoscaleAsync(resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return migrateMongoDBCollectionToAutoscaleAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateMongoDBCollectionToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (collectionName == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateMongoDBCollectionToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + collectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + Mono>> mono = + migrateMongoDBCollectionToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateMongoDBCollectionToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, collectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateMongoDBCollectionToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return beginMigrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + return migrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + return migrateMongoDBCollectionToManualThroughputAsync( + resourceGroupName, accountName, databaseName, collectionName, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java new file mode 100644 index 0000000000000..fb7895af72ef7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/MongoDBResourcesImpl.java @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.MongoDBResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MongoDBResourcesImpl implements MongoDBResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBResourcesImpl.class); + + private final MongoDBResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public MongoDBResourcesImpl( + MongoDBResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBDatabaseGetResultsImpl(inner1, this.manager())); + } + + public MongoDBDatabaseGetResults getMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName) { + MongoDBDatabaseGetResultsInner inner = + this.serviceClient().getMongoDBDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new MongoDBDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MongoDBDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteMongoDBDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteMongoDBDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getMongoDBDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateMongoDBDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateMongoDBDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listMongoDBCollections(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listMongoDBCollections(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new MongoDBCollectionGetResultsImpl(inner1, this.manager())); + } + + public MongoDBCollectionGetResults getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBCollectionGetResultsInner inner = + this.serviceClient().getMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new MongoDBCollectionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MongoDBCollectionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + this.serviceClient().deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName); + } + + public void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + this + .serviceClient() + .deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public ThroughputSettingsGetResults getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .getMongoDBCollectionThroughput(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + Response inner = + this + .serviceClient() + .getMongoDBCollectionThroughputWithResponse( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBCollectionThroughput( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateMongoDBCollectionThroughput( + resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToAutoscale(resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToAutoscale( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToManualThroughput( + resourceGroupName, accountName, databaseName, collectionName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateMongoDBCollectionToManualThroughput( + resourceGroupName, accountName, databaseName, collectionName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public MongoDBDatabaseGetResults getMongoDBDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this + .getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + } + + public Response getMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + return this.getMongoDBDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public MongoDBCollectionGetResults getMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse( + resourceGroupName, accountName, databaseName, collectionName, Context.NONE) + .getValue(); + } + + public Response getMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + return this + .getMongoDBCollectionWithResponse(resourceGroupName, accountName, databaseName, collectionName, context); + } + + public void deleteMongoDBDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteMongoDBDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + this.deleteMongoDBDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteMongoDBCollectionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, Context.NONE); + } + + public void deleteMongoDBCollectionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "mongodbDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'mongodbDatabases'.", id))); + } + String collectionName = Utils.getValueFromIdByName(id, "collections"); + if (collectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'collections'.", id))); + } + this.deleteMongoDBCollection(resourceGroupName, accountName, databaseName, collectionName, context); + } + + private MongoDBResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public MongoDBDatabaseGetResultsImpl defineUpdateMongoDBDatabase(String name) { + return new MongoDBDatabaseGetResultsImpl(name, this.manager()); + } + + public MongoDBCollectionGetResultsImpl defineUpdateMongoDBCollection(String name) { + return new MongoDBCollectionGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java new file mode 100644 index 0000000000000..db8258369c3fb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceConnectionInfoResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; + +public final class NotebookWorkspaceConnectionInfoResultImpl implements NotebookWorkspaceConnectionInfoResult { + private NotebookWorkspaceConnectionInfoResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + NotebookWorkspaceConnectionInfoResultImpl( + NotebookWorkspaceConnectionInfoResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String authToken() { + return this.innerModel().authToken(); + } + + public String notebookServerEndpoint() { + return this.innerModel().notebookServerEndpoint(); + } + + public NotebookWorkspaceConnectionInfoResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java new file mode 100644 index 0000000000000..b2c866c9ebefc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspaceImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspace; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +public final class NotebookWorkspaceImpl + implements NotebookWorkspace, NotebookWorkspace.Definition, NotebookWorkspace.Update { + private NotebookWorkspaceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String notebookServerEndpoint() { + return this.innerModel().notebookServerEndpoint(); + } + + public String status() { + return this.innerModel().status(); + } + + public NotebookWorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private NotebookWorkspaceName notebookWorkspaceName; + + private NotebookWorkspaceCreateUpdateParameters createNotebookCreateUpdateParameters; + + private NotebookWorkspaceCreateUpdateParameters updateNotebookCreateUpdateParameters; + + public NotebookWorkspaceImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public NotebookWorkspace create() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + createNotebookCreateUpdateParameters, + Context.NONE); + return this; + } + + public NotebookWorkspace create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + createNotebookCreateUpdateParameters, + context); + return this; + } + + NotebookWorkspaceImpl( + NotebookWorkspaceName name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new NotebookWorkspaceInner(); + this.serviceManager = serviceManager; + this.notebookWorkspaceName = name; + this.createNotebookCreateUpdateParameters = new NotebookWorkspaceCreateUpdateParameters(); + } + + public NotebookWorkspaceImpl update() { + this.updateNotebookCreateUpdateParameters = new NotebookWorkspaceCreateUpdateParameters(); + return this; + } + + public NotebookWorkspace apply() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + updateNotebookCreateUpdateParameters, + Context.NONE); + return this; + } + + public NotebookWorkspace apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + resourceGroupName, + accountName, + notebookWorkspaceName, + updateNotebookCreateUpdateParameters, + context); + return this; + } + + NotebookWorkspaceImpl( + NotebookWorkspaceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(innerObject.id(), "notebookWorkspaces")); + } + + public NotebookWorkspace refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public NotebookWorkspace refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context) + .getValue(); + return this; + } + + public NotebookWorkspaceConnectionInfoResult listConnectionInfo() { + return serviceManager + .notebookWorkspaces() + .listConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName); + } + + public Response listConnectionInfoWithResponse(Context context) { + return serviceManager + .notebookWorkspaces() + .listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void regenerateAuthToken() { + serviceManager.notebookWorkspaces().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void regenerateAuthToken(Context context) { + serviceManager + .notebookWorkspaces() + .regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void start() { + serviceManager.notebookWorkspaces().start(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void start(Context context) { + serviceManager.notebookWorkspaces().start(resourceGroupName, accountName, notebookWorkspaceName, context); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java new file mode 100644 index 0000000000000..970569074cf7f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesClientImpl.java @@ -0,0 +1,1799 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.NotebookWorkspacesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceListResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in NotebookWorkspacesClient. */ +public final class NotebookWorkspacesClientImpl implements NotebookWorkspacesClient { + private final ClientLogger logger = new ClientLogger(NotebookWorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final NotebookWorkspacesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of NotebookWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NotebookWorkspacesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(NotebookWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientNotebookWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface NotebookWorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @BodyParam("application/json") NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionInfo( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> regenerateAuthToken( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("notebookWorkspaceName") NotebookWorkspaceName notebookWorkspaceName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return getAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + if (notebookCreateUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter notebookCreateUpdateParameters is required and cannot be null.")); + } else { + notebookCreateUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + notebookCreateUpdateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + if (notebookCreateUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter notebookCreateUpdateParameters is required and cannot be null.")); + } else { + notebookCreateUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + notebookCreateUpdateParameters, + accept, + context); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NotebookWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NotebookWorkspaceInner.class, + NotebookWorkspaceInner.class, + Context.NONE); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NotebookWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NotebookWorkspaceInner.class, + NotebookWorkspaceInner.class, + context); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .getSyncPoller(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NotebookWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters) { + return createOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters) + .block(); + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notebook workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceInner createOrUpdate( + String resourceGroupName, + String accountName, + NotebookWorkspaceName notebookWorkspaceName, + NotebookWorkspaceCreateUpdateParameters notebookCreateUpdateParameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, context) + .block(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + deleteAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + deleteAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionInfoWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConnectionInfoWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listConnectionInfo( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionInfoAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotebookWorkspaceConnectionInfoResultInner listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return listConnectionInfoAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return listConnectionInfoWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .block(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateAuthTokenWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> regenerateAuthTokenWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateAuthToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRegenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRegenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + regenerateAuthTokenWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .getSyncPoller(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAuthTokenAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginRegenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + regenerateAuthTokenAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (notebookWorkspaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter notebookWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + notebookWorkspaceName, + accept, + context); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + Mono>> mono = + startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startWithResponseAsync(resourceGroupName, accountName, notebookWorkspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName).getSyncPoller(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context).getSyncPoller(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + return beginStartAsync(resourceGroupName, accountName, notebookWorkspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + startAsync(resourceGroupName, accountName, notebookWorkspaceName).block(); + } + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + startAsync(resourceGroupName, accountName, notebookWorkspaceName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java new file mode 100644 index 0000000000000..66d112fb151a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/NotebookWorkspacesImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.NotebookWorkspacesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspace; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceConnectionInfoResult; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class NotebookWorkspacesImpl implements NotebookWorkspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspacesImpl.class); + + private final NotebookWorkspacesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public NotebookWorkspacesImpl( + NotebookWorkspacesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new NotebookWorkspaceImpl(inner1, this.manager())); + } + + public NotebookWorkspace get( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + NotebookWorkspaceInner inner = this.serviceClient().get(resourceGroupName, accountName, notebookWorkspaceName); + if (inner != null) { + return new NotebookWorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NotebookWorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().delete(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public NotebookWorkspaceConnectionInfoResult listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + NotebookWorkspaceConnectionInfoResultInner inner = + this.serviceClient().listConnectionInfo(resourceGroupName, accountName, notebookWorkspaceName); + if (inner != null) { + return new NotebookWorkspaceConnectionInfoResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + Response inner = + this + .serviceClient() + .listConnectionInfoWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NotebookWorkspaceConnectionInfoResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().regenerateAuthToken(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName) { + this.serviceClient().start(resourceGroupName, accountName, notebookWorkspaceName); + } + + public void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context) { + this.serviceClient().start(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public NotebookWorkspace getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + this.delete(resourceGroupName, accountName, notebookWorkspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + NotebookWorkspaceName notebookWorkspaceName = + NotebookWorkspaceName.fromString(Utils.getValueFromIdByName(id, "notebookWorkspaces")); + if (notebookWorkspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notebookWorkspaces'.", id))); + } + this.delete(resourceGroupName, accountName, notebookWorkspaceName, context); + } + + private NotebookWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public NotebookWorkspaceImpl define(NotebookWorkspaceName name) { + return new NotebookWorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..202d50356b72d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.Operation; +import com.azure.resourcemanager.cosmos.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..c39a07e58f6d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.OperationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DocumentDB/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5ccc664e91681 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.OperationsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.cosmos.generated.models.Operation; +import com.azure.resourcemanager.cosmos.generated.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java new file mode 100644 index 0000000000000..fdc860e02cae5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsClientImpl.java @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdRegionsClient. */ +public final class PartitionKeyRangeIdRegionsClientImpl implements PartitionKeyRangeIdRegionsClient { + private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdRegionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PartitionKeyRangeIdRegionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PartitionKeyRangeIdRegionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + PartitionKeyRangeIdRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPartitionKeyRangeIdRegions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PartitionKeyRangeIdRegionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("region") String region, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @PathParam("partitionKeyRangeId") String partitionKeyRangeId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (region == null) { + return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java new file mode 100644 index 0000000000000..775cc2bfbe918 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdRegionsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdRegionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIdRegions; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PartitionKeyRangeIdRegionsImpl implements PartitionKeyRangeIdRegions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdRegionsImpl.class); + + private final PartitionKeyRangeIdRegionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PartitionKeyRangeIdRegionsImpl( + PartitionKeyRangeIdRegionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, + accountName, + region, + databaseRid, + collectionRid, + partitionKeyRangeId, + filter, + context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java new file mode 100644 index 0000000000000..b7aab467830f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsClientImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PartitionKeyRangeIdsClient. */ +public final class PartitionKeyRangeIdsClientImpl implements PartitionKeyRangeIdsClient { + private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PartitionKeyRangeIdsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PartitionKeyRangeIdsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PartitionKeyRangeIdsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPartitionKeyRangeIds to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PartitionKeyRangeIdsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}" + + "/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseRid") String databaseRid, + @PathParam("collectionRid") String collectionRid, + @PathParam("partitionKeyRangeId") String partitionKeyRangeId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseRid == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseRid is required and cannot be null.")); + } + if (collectionRid == null) { + return Mono.error(new IllegalArgumentException("Parameter collectionRid is required and cannot be null.")); + } + if (partitionKeyRangeId == null) { + return Mono + .error(new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseRid, + collectionRid, + partitionKeyRangeId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java new file mode 100644 index 0000000000000..bab7c05802ece --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionKeyRangeIdsImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PartitionKeyRangeIdsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKeyRangeIds; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PartitionKeyRangeIdsImpl implements PartitionKeyRangeIds { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionKeyRangeIdsImpl.class); + + private final PartitionKeyRangeIdsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PartitionKeyRangeIdsImpl( + PartitionKeyRangeIdsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics( + resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter, context); + return Utils.mapPage(inner, inner1 -> new PartitionMetricImpl(inner1, this.manager())); + } + + private PartitionKeyRangeIdsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java new file mode 100644 index 0000000000000..a0be4eaaa7ca9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionMetricImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.MetricValue; +import com.azure.resourcemanager.cosmos.generated.models.PartitionMetric; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PartitionMetricImpl implements PartitionMetric { + private PartitionMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionMetricImpl( + PartitionMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java new file mode 100644 index 0000000000000..ab62b6e3e8ef6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PartitionUsageImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PartitionUsage; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; + +public final class PartitionUsageImpl implements PartitionUsage { + private PartitionUsageInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PartitionUsageImpl( + PartitionUsageInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public String quotaPeriod() { + return this.innerModel().quotaPeriod(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public String partitionId() { + return this.innerModel().partitionId(); + } + + public String partitionKeyRangeId() { + return this.innerModel().partitionKeyRangeId(); + } + + public PartitionUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java new file mode 100644 index 0000000000000..78b8913125f00 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileMetricImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricValue; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PercentileMetricImpl implements PercentileMetric { + private PercentileMetricInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PercentileMetricImpl( + PercentileMetricInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PercentileMetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java new file mode 100644 index 0000000000000..eec28ac5cf7a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsClientImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileSourceTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentileSourceTargetsClient. */ +public final class PercentileSourceTargetsClientImpl implements PercentileSourceTargetsClient { + private final ClientLogger logger = new ClientLogger(PercentileSourceTargetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentileSourceTargetsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentileSourceTargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentileSourceTargetsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PercentileSourceTargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentileSourceTargets to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentileSourceTargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile" + + "/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("sourceRegion") String sourceRegion, + @PathParam("targetRegion") String targetRegion, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (sourceRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceRegion is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (sourceRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceRegion is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + sourceRegion, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listMetricsSinglePageAsync( + resourceGroupName, accountName, sourceRegion, targetRegion, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + return new PagedIterable<>( + listMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java new file mode 100644 index 0000000000000..9d35f729155c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileSourceTargetsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileSourceTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileSourceTargets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentileSourceTargetsImpl implements PercentileSourceTargets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileSourceTargetsImpl.class); + + private final PercentileSourceTargetsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentileSourceTargetsImpl( + PercentileSourceTargetsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMetrics(resourceGroupName, accountName, sourceRegion, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileSourceTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java new file mode 100644 index 0000000000000..f6236ec368d12 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsClientImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentileTargetsClient. */ +public final class PercentileTargetsClientImpl implements PercentileTargetsClient { + private final ClientLogger logger = new ClientLogger(PercentileTargetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentileTargetsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentileTargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentileTargetsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(PercentileTargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentileTargets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentileTargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("targetRegion") String targetRegion, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String targetRegion, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (targetRegion == null) { + return Mono.error(new IllegalArgumentException("Parameter targetRegion is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + targetRegion, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String targetRegion, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, accountName, targetRegion, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, targetRegion, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, targetRegion, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java new file mode 100644 index 0000000000000..a386c4dd16c4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentileTargetsImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentileTargetsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.PercentileTargets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentileTargetsImpl implements PercentileTargets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileTargetsImpl.class); + + private final PercentileTargetsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentileTargetsImpl( + PercentileTargetsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, targetRegion, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, targetRegion, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentileTargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java new file mode 100644 index 0000000000000..fd062527a1404 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesClientImpl.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentilesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetricListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PercentilesClient. */ +public final class PercentilesClientImpl implements PercentilesClient { + private final ClientLogger logger = new ClientLogger(PercentilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PercentilesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PercentilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PercentilesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(PercentilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPercentiles to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PercentilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/percentile/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String accountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, accountName, filter, context)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter)); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, accountName, filter, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java new file mode 100644 index 0000000000000..183af0a0c686a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PercentilesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PercentilesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.azure.resourcemanager.cosmos.generated.models.PercentileMetric; +import com.azure.resourcemanager.cosmos.generated.models.Percentiles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PercentilesImpl implements Percentiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentilesImpl.class); + + private final PercentilesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PercentilesImpl( + PercentilesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics(String resourceGroupName, String accountName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, accountName, filter, context); + return Utils.mapPage(inner, inner1 -> new PercentileMetricImpl(inner1, this.manager())); + } + + private PercentilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..62d182b90eda1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionImpl withGroupId(String groupId) { + this.innerModel().withGroupId(groupId); + return this; + } + + public PrivateEndpointConnectionImpl withProvisioningState(String provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..b547ef1442ba9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1071 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..1c8e7b8cd52a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cosmos.generated.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, accountName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, accountName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..7c35846d0da78 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..0bc87c39f2e2c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("accountName") String accountName, + @PathParam("groupName") String groupName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAccountSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAccountAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listByDatabaseAccountSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listByDatabaseAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + groupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accountName, + groupName, + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String groupName) { + return getWithResponseAsync(resourceGroupName, accountName, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String accountName, String groupName) { + return getAsync(resourceGroupName, accountName, groupName).block(); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, groupName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..1959fc6f18e44 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabaseAccount(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String accountName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, accountName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..152d123a87800 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.LocationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> locationGet( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Cosmos DB locations and their properties. + * + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Cosmos DB locations and their properties. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List Cosmos DB locations and their properties. + * + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * List Cosmos DB locations and their properties. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * List Cosmos DB locations and their properties. + * + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Cosmos DB locations and their properties. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> locationGetWithResponseAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .locationGet( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> locationGetWithResponseAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .locationGet( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context); + } + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono locationGetAsync(String location) { + return locationGetWithResponseAsync(location) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationGetResultInner locationGet(String location) { + return locationGetAsync(location).block(); + } + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response locationGetWithResponse(String location, Context context) { + return locationGetWithResponseAsync(location, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..b0b70b22e759c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ResourceProvidersImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.LocationGetResult; +import com.azure.resourcemanager.cosmos.generated.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new LocationGetResultImpl(inner1, this.manager())); + } + + public LocationGetResult locationGet(String location) { + LocationGetResultInner inner = this.serviceClient().locationGet(location); + if (inner != null) { + return new LocationGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response locationGetWithResponse(String location, Context context) { + Response inner = this.serviceClient().locationGetWithResponse(location, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LocationGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java new file mode 100644 index 0000000000000..5d201b80c7fb8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountGetResultImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.ApiType; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableLocationResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class RestorableDatabaseAccountGetResultImpl implements RestorableDatabaseAccountGetResult { + private RestorableDatabaseAccountGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableDatabaseAccountGetResultImpl( + RestorableDatabaseAccountGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public OffsetDateTime deletionTime() { + return this.innerModel().deletionTime(); + } + + public ApiType apiType() { + return this.innerModel().apiType(); + } + + public List restorableLocations() { + List inner = this.innerModel().restorableLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorableDatabaseAccountGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java new file mode 100644 index 0000000000000..1b59a6f4c803d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsClientImpl.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableDatabaseAccountsClient. */ +public final class RestorableDatabaseAccountsClientImpl implements RestorableDatabaseAccountsClient { + private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableDatabaseAccountsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableDatabaseAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDatabaseAccountsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDatabaseAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableDatabaseAccounts to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableDatabaseAccountsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByLocation( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>(() -> listByLocationSinglePageAsync(location)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location, Context context) { + return new PagedFlux<>(() -> listByLocationSinglePageAsync(location, context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(listByLocationAsync(location)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(listByLocationAsync(location, context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByLocationWithResponseAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByLocationWithResponseAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByLocation( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByLocationAsync(String location, String instanceId) { + return getByLocationWithResponseAsync(location, instanceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDatabaseAccountGetResultInner getByLocation(String location, String instanceId) { + return getByLocationAsync(location, instanceId).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByLocationWithResponse( + String location, String instanceId, Context context) { + return getByLocationWithResponseAsync(location, instanceId, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java new file mode 100644 index 0000000000000..ac76305206283 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableDatabaseAccountsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableDatabaseAccountsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccountGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableDatabaseAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableDatabaseAccountsImpl implements RestorableDatabaseAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsImpl.class); + + private final RestorableDatabaseAccountsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableDatabaseAccountsImpl( + RestorableDatabaseAccountsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new RestorableDatabaseAccountGetResultImpl(inner1, this.manager())); + } + + public RestorableDatabaseAccountGetResult getByLocation(String location, String instanceId) { + RestorableDatabaseAccountGetResultInner inner = this.serviceClient().getByLocation(location, instanceId); + if (inner != null) { + return new RestorableDatabaseAccountGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByLocationWithResponse( + String location, String instanceId, Context context) { + Response inner = + this.serviceClient().getByLocationWithResponse(location, instanceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDatabaseAccountGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RestorableDatabaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java new file mode 100644 index 0000000000000..9ce2a7c08c85c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionPropertiesResource; + +public final class RestorableMongodbCollectionGetResultImpl implements RestorableMongodbCollectionGetResult { + private RestorableMongodbCollectionGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbCollectionGetResultImpl( + RestorableMongodbCollectionGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbCollectionPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbCollectionGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java new file mode 100644 index 0000000000000..a9c3c88b72834 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsClientImpl.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbCollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbCollectionsClient. */ +public final class RestorableMongodbCollectionsClientImpl implements RestorableMongodbCollectionsClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbCollectionsService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbCollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbCollectionsClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbCollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbCollections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbCollectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restorableMongodbDatabaseRid") String restorableMongodbDatabaseRid, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableMongodbDatabaseRid) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableMongodbDatabaseRid, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableMongodbDatabaseRid, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableMongodbDatabaseRid) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restorableMongodbDatabaseRid, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableMongodbDatabaseRid = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableMongodbDatabaseRid)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restorableMongodbDatabaseRid, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java new file mode 100644 index 0000000000000..d5e43e72be814 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbCollectionsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbCollectionsClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollectionGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbCollections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbCollectionsImpl implements RestorableMongodbCollections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsImpl.class); + + private final RestorableMongodbCollectionsClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbCollectionsImpl( + RestorableMongodbCollectionsClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = + this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restorableMongodbDatabaseRid, context); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbCollectionGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..73b1aee282d2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasePropertiesResource; + +public final class RestorableMongodbDatabaseGetResultImpl implements RestorableMongodbDatabaseGetResult { + private RestorableMongodbDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableMongodbDatabaseGetResultImpl( + RestorableMongodbDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableMongodbDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableMongodbDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java new file mode 100644 index 0000000000000..4bc1cd9e57840 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesClientImpl.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabasesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbDatabasesClient. */ +public final class RestorableMongodbDatabasesClientImpl implements RestorableMongodbDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbDatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbDatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + return new PagedIterable<>(listAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java new file mode 100644 index 0000000000000..2dfa5e0198083 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbDatabasesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbDatabasesImpl implements RestorableMongodbDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesImpl.class); + + private final RestorableMongodbDatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbDatabasesImpl( + RestorableMongodbDatabasesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableMongodbDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableMongodbDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java new file mode 100644 index 0000000000000..3874a5d4a3679 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesClientImpl.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResourcesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableMongodbResourcesClient. */ +public final class RestorableMongodbResourcesClientImpl implements RestorableMongodbResourcesClient { + private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableMongodbResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableMongodbResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableMongodbResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableMongodbResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableMongodbResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableMongodbResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restoreLocation") String restoreLocation, + @QueryParam("restoreTimestampInUtc") String restoreTimestampInUtc, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java new file mode 100644 index 0000000000000..e7746c23e0f48 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableMongodbResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableMongodbResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import com.azure.resourcemanager.cosmos.generated.models.RestorableMongodbResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableMongodbResourcesImpl implements RestorableMongodbResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesImpl.class); + + private final RestorableMongodbResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableMongodbResourcesImpl( + RestorableMongodbResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restoreLocation, restoreTimestampInUtc, context); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + private RestorableMongodbResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java new file mode 100644 index 0000000000000..7a0629d1d88c2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainerGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerPropertiesResource; + +public final class RestorableSqlContainerGetResultImpl implements RestorableSqlContainerGetResult { + private RestorableSqlContainerGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlContainerGetResultImpl( + RestorableSqlContainerGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlContainerPropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlContainerGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java new file mode 100644 index 0000000000000..0806c99803374 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlContainersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainersListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlContainersClient. */ +public final class RestorableSqlContainersClientImpl implements RestorableSqlContainersClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlContainersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlContainersService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlContainersClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlContainers to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlContainersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restorableSqlDatabaseRid") String restorableSqlDatabaseRid, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restorableSqlDatabaseRid, String startTime, String endTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableSqlDatabaseRid, + startTime, + endTime, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restorableSqlDatabaseRid, + startTime, + endTime, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restorableSqlDatabaseRid, String startTime, String endTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restorableSqlDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restorableSqlDatabaseRid = null; + final String startTime = null; + final String endTime = null; + return new PagedIterable<>(listAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + return new PagedIterable<>( + listAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java new file mode 100644 index 0000000000000..72bac7350c48d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlContainersImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlContainersClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainerGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlContainers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlContainersImpl implements RestorableSqlContainers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainersImpl.class); + + private final RestorableSqlContainersClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlContainersImpl( + RestorableSqlContainersClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlContainerGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java new file mode 100644 index 0000000000000..1bf685340975e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabaseGetResultImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasePropertiesResource; + +public final class RestorableSqlDatabaseGetResultImpl implements RestorableSqlDatabaseGetResult { + private RestorableSqlDatabaseGetResultInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + RestorableSqlDatabaseGetResultImpl( + RestorableSqlDatabaseGetResultInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RestorableSqlDatabasePropertiesResource resource() { + return this.innerModel().resource(); + } + + public RestorableSqlDatabaseGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java new file mode 100644 index 0000000000000..93c67eb801d30 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesClientImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabasesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlDatabasesClient. */ +public final class RestorableSqlDatabasesClientImpl implements RestorableSqlDatabasesClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlDatabasesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlDatabasesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, context)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + return new PagedIterable<>(listAsync(location, instanceId)); + } + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java new file mode 100644 index 0000000000000..ce882c2e2eba3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlDatabasesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlDatabasesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabaseGetResult; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlDatabases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlDatabasesImpl implements RestorableSqlDatabases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesImpl.class); + + private final RestorableSqlDatabasesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlDatabasesImpl( + RestorableSqlDatabasesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, String instanceId, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, context); + return Utils.mapPage(inner, inner1 -> new RestorableSqlDatabaseGetResultImpl(inner1, this.manager())); + } + + private RestorableSqlDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java new file mode 100644 index 0000000000000..6f3380132335c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResourcesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableSqlResourcesClient. */ +public final class RestorableSqlResourcesClientImpl implements RestorableSqlResourcesClient { + private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorableSqlResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of RestorableSqlResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableSqlResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy + .create(RestorableSqlResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientRestorableSqlResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface RestorableSqlResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" + + "/restorableDatabaseAccounts/{instanceId}/restorableSqlResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("instanceId") String instanceId, + @QueryParam("restoreLocation") String restoreLocation, + @QueryParam("restoreTimestampInUtc") String restoreTimestampInUtc, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + instanceId, + restoreLocation, + restoreTimestampInUtc, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc) { + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedFlux<>(() -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String instanceId) { + final String restoreLocation = null; + final String restoreTimestampInUtc = null; + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc)); + } + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the restorable SQL resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + return new PagedIterable<>(listAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, context)); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java new file mode 100644 index 0000000000000..94eb475f1bd03 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/RestorableSqlResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.RestorableSqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseRestoreResource; +import com.azure.resourcemanager.cosmos.generated.models.RestorableSqlResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorableSqlResourcesImpl implements RestorableSqlResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesImpl.class); + + private final RestorableSqlResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public RestorableSqlResourcesImpl( + RestorableSqlResourcesClient innerClient, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String instanceId) { + PagedIterable inner = this.serviceClient().list(location, instanceId); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context) { + PagedIterable inner = + this.serviceClient().list(location, instanceId, restoreLocation, restoreTimestampInUtc, context); + return Utils.mapPage(inner, inner1 -> new DatabaseRestoreResourceImpl(inner1, this.manager())); + } + + private RestorableSqlResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServiceResourceImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServiceResourceImpl.java new file mode 100644 index 0000000000000..f7d94528cfd11 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServiceResourceImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResource; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +public final class ServiceResourceImpl implements ServiceResource, ServiceResource.Definition { + private ServiceResourceInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + ServiceResourceImpl( + ServiceResourceInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServiceResourceProperties properties() { + return this.innerModel().properties(); + } + + public ServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String serviceName; + + private ServiceResourceCreateUpdateParameters createCreateUpdateParameters; + + public ServiceResourceImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public ServiceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .create(resourceGroupName, accountName, serviceName, createCreateUpdateParameters, Context.NONE); + return this; + } + + public ServiceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .create(resourceGroupName, accountName, serviceName, createCreateUpdateParameters, context); + return this; + } + + ServiceResourceImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new ServiceResourceInner(); + this.serviceManager = serviceManager; + this.serviceName = name; + this.createCreateUpdateParameters = new ServiceResourceCreateUpdateParameters(); + } + + public ServiceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, accountName, serviceName, Context.NONE) + .getValue(); + return this; + } + + public ServiceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, accountName, serviceName, context) + .getValue(); + return this; + } + + public ServiceResourceImpl withInstanceSize(ServiceSize instanceSize) { + this.createCreateUpdateParameters.withInstanceSize(instanceSize); + return this; + } + + public ServiceResourceImpl withInstanceCount(Integer instanceCount) { + this.createCreateUpdateParameters.withInstanceCount(instanceCount); + return this; + } + + public ServiceResourceImpl withServiceType(ServiceType serviceType) { + this.createCreateUpdateParameters.withServiceType(serviceType); + return this; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java new file mode 100644 index 0000000000000..c3e01921e471d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesClientImpl.java @@ -0,0 +1,1035 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.ServicesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResourceListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public final class ServicesClientImpl implements ServicesClient { + private final ClientLogger logger = new ClientLogger(ServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServicesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of ServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesClientImpl(CosmosDBManagementClientImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientServices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface ServicesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/services") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/services/{serviceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceResourceCreateUpdateParameters createUpdateParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/services/{serviceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/services/{serviceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName)); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName, context)); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (createUpdateParameters == null) { + return Mono + .error( + new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null.")); + } else { + createUpdateParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + createUpdateParameters, + accept, + context); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServiceResourceInner> beginCreateAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, accountName, serviceName, createUpdateParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServiceResourceInner.class, + ServiceResourceInner.class, + Context.NONE); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServiceResourceInner> beginCreateAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, accountName, serviceName, createUpdateParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServiceResourceInner.class, ServiceResourceInner.class, context); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServiceResourceInner> beginCreate( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters) { + return beginCreateAsync(resourceGroupName, accountName, serviceName, createUpdateParameters).getSyncPoller(); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServiceResourceInner> beginCreate( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateAsync(resourceGroupName, accountName, serviceName, createUpdateParameters, context) + .getSyncPoller(); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters) { + return beginCreateAsync(resourceGroupName, accountName, serviceName, createUpdateParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context) { + return beginCreateAsync(resourceGroupName, accountName, serviceName, createUpdateParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner create( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters) { + return createAsync(resourceGroupName, accountName, serviceName, createUpdateParameters).block(); + } + + /** + * Creates a service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param createUpdateParameters The Service resource parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties for the database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner create( + String resourceGroupName, + String accountName, + String serviceName, + ServiceResourceCreateUpdateParameters createUpdateParameters, + Context context) { + return createAsync(resourceGroupName, accountName, serviceName, createUpdateParameters, context).block(); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String serviceName) { + return getWithResponseAsync(resourceGroupName, accountName, serviceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner get(String resourceGroupName, String accountName, String serviceName) { + return getAsync(resourceGroupName, accountName, serviceName).block(); + } + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String serviceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, serviceName, context).block(); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String accountName, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + serviceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String serviceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, serviceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String serviceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, serviceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String serviceName) { + return beginDeleteAsync(resourceGroupName, accountName, serviceName).getSyncPoller(); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String serviceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, serviceName, context).getSyncPoller(); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String serviceName) { + return beginDeleteAsync(resourceGroupName, accountName, serviceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String serviceName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, serviceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String serviceName) { + deleteAsync(resourceGroupName, accountName, serviceName).block(); + } + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String serviceName, Context context) { + deleteAsync(resourceGroupName, accountName, serviceName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..b940bcb9c54ab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ServicesImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.ServicesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.ServiceResource; +import com.azure.resourcemanager.cosmos.generated.models.Services; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServicesImpl implements Services { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServicesImpl.class); + + private final ServicesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public ServicesImpl( + ServicesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new ServiceResourceImpl(inner1, this.manager())); + } + + public ServiceResource get(String resourceGroupName, String accountName, String serviceName) { + ServiceResourceInner inner = this.serviceClient().get(resourceGroupName, accountName, serviceName); + if (inner != null) { + return new ServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String serviceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, serviceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String serviceName) { + this.serviceClient().delete(resourceGroupName, accountName, serviceName); + } + + public void delete(String resourceGroupName, String accountName, String serviceName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, serviceName, context); + } + + public ServiceResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, serviceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, serviceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.delete(resourceGroupName, accountName, serviceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.delete(resourceGroupName, accountName, serviceName, context); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public ServiceResourceImpl define(String name) { + return new ServiceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java new file mode 100644 index 0000000000000..4e5147926060f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlContainerGetResultsImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import java.util.Collections; +import java.util.Map; + +public final class SqlContainerGetResultsImpl + implements SqlContainerGetResults, SqlContainerGetResults.Definition, SqlContainerGetResults.Update { + private SqlContainerGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SqlContainerGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public SqlContainerGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlContainerGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String containerName; + + private SqlContainerCreateUpdateParameters createCreateUpdateSqlContainerParameters; + + private SqlContainerCreateUpdateParameters updateCreateUpdateSqlContainerParameters; + + public SqlContainerGetResultsImpl withExistingSqlDatabase( + String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + public SqlContainerGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlContainer( + resourceGroupName, + accountName, + databaseName, + containerName, + createCreateUpdateSqlContainerParameters, + Context.NONE); + return this; + } + + public SqlContainerGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlContainer( + resourceGroupName, + accountName, + databaseName, + containerName, + createCreateUpdateSqlContainerParameters, + context); + return this; + } + + SqlContainerGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlContainerGetResultsInner(); + this.serviceManager = serviceManager; + this.containerName = name; + this.createCreateUpdateSqlContainerParameters = new SqlContainerCreateUpdateParameters(); + } + + public SqlContainerGetResultsImpl update() { + this.updateCreateUpdateSqlContainerParameters = new SqlContainerCreateUpdateParameters(); + return this; + } + + public SqlContainerGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlContainer( + resourceGroupName, + accountName, + databaseName, + containerName, + updateCreateUpdateSqlContainerParameters, + Context.NONE); + return this; + } + + public SqlContainerGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlContainer( + resourceGroupName, + accountName, + databaseName, + containerName, + updateCreateUpdateSqlContainerParameters, + context); + return this; + } + + SqlContainerGetResultsImpl( + SqlContainerGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + } + + public SqlContainerGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + return this; + } + + public SqlContainerGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context) + .getValue(); + return this; + } + + public BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location) { + return serviceManager + .sqlResources() + .retrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, containerName, location); + } + + public BackupInformation retrieveContinuousBackupInformation( + ContinuousBackupRestoreLocation location, Context context) { + return serviceManager + .sqlResources() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location, context); + } + + public SqlContainerGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlContainerParameters.withLocation(location.toString()); + return this; + } + + public SqlContainerGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlContainerParameters.withLocation(location); + return this; + } + + public SqlContainerGetResultsImpl withResource(SqlContainerResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withResource(resource); + return this; + } + } + + public SqlContainerGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withTags(tags); + return this; + } + } + + public SqlContainerGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withIdentity(identity); + return this; + } + } + + public SqlContainerGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateSqlContainerParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateSqlContainerParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..01416a40e16e3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlDatabaseGetResultsImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.util.Collections; +import java.util.Map; + +public final class SqlDatabaseGetResultsImpl + implements SqlDatabaseGetResults, SqlDatabaseGetResults.Definition, SqlDatabaseGetResults.Update { + private SqlDatabaseGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SqlDatabaseGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public SqlDatabaseGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlDatabaseGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private SqlDatabaseCreateUpdateParameters createCreateUpdateSqlDatabaseParameters; + + private SqlDatabaseCreateUpdateParameters updateCreateUpdateSqlDatabaseParameters; + + public SqlDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public SqlDatabaseGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlDatabase( + resourceGroupName, + accountName, + databaseName, + createCreateUpdateSqlDatabaseParameters, + Context.NONE); + return this; + } + + public SqlDatabaseGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlDatabase( + resourceGroupName, accountName, databaseName, createCreateUpdateSqlDatabaseParameters, context); + return this; + } + + SqlDatabaseGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlDatabaseGetResultsInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + this.createCreateUpdateSqlDatabaseParameters = new SqlDatabaseCreateUpdateParameters(); + } + + public SqlDatabaseGetResultsImpl update() { + this.updateCreateUpdateSqlDatabaseParameters = new SqlDatabaseCreateUpdateParameters(); + return this; + } + + public SqlDatabaseGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlDatabase( + resourceGroupName, + accountName, + databaseName, + updateCreateUpdateSqlDatabaseParameters, + Context.NONE); + return this; + } + + public SqlDatabaseGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlDatabase( + resourceGroupName, accountName, databaseName, updateCreateUpdateSqlDatabaseParameters, context); + return this; + } + + SqlDatabaseGetResultsImpl( + SqlDatabaseGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + } + + public SqlDatabaseGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public SqlDatabaseGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context) + .getValue(); + return this; + } + + public SqlDatabaseGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlDatabaseParameters.withLocation(location.toString()); + return this; + } + + public SqlDatabaseGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlDatabaseParameters.withLocation(location); + return this; + } + + public SqlDatabaseGetResultsImpl withResource(SqlDatabaseResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withResource(resource); + return this; + } + } + + public SqlDatabaseGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withTags(tags); + return this; + } + } + + public SqlDatabaseGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withIdentity(identity); + return this; + } + } + + public SqlDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateSqlDatabaseParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateSqlDatabaseParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java new file mode 100644 index 0000000000000..928d395ae1cd9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesClientImpl.java @@ -0,0 +1,10755 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerListResult; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlResourcesClient. */ +public final class SqlResourcesClientImpl implements SqlResourcesClient { + private final ClientLogger logger = new ClientLogger(SqlResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SqlResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of SqlResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(SqlResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientSqlResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface SqlResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlDatabases( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlDatabase( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateSqlDatabaseThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + + "/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlDatabaseToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlDatabaseToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlContainers( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlContainer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlContainerThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateSqlContainerThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlContainerToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/throughputSettings/default/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateSqlContainerToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlStoredProcedures( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/storedProcedures/{storedProcedureName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlStoredProcedure( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("storedProcedureName") String storedProcedureName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlUserDefinedFunctions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/userDefinedFunctions/{userDefinedFunctionName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlUserDefinedFunction( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("userDefinedFunctionName") String userDefinedFunctionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlTriggers( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers" + + "/{triggerName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlTrigger( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @PathParam("triggerName") String triggerName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlRoleDefinition( + @HostParam("$host") String endpoint, + @PathParam("roleDefinitionId") String roleDefinitionId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlRoleDefinitions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteSqlRoleAssignment( + @HostParam("$host") String endpoint, + @PathParam("roleAssignmentId") String roleAssignmentId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlRoleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSqlRoleAssignments( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" + + "/retrieveContinuousBackupInformation") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> retrieveContinuousBackupInformation( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("databaseName") String databaseName, + @PathParam("containerName") String containerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ContinuousBackupRestoreLocation location, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the SQL databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlDatabasesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlDatabasesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlDatabases( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlDatabasesAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlDatabasesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the SQL databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlDatabasesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlDatabasesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the SQL databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlDatabases(String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlDatabasesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the SQL databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlDatabasesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner getSqlDatabase( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateSqlDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlDatabaseParameters is required and cannot be null.")); + } else { + createUpdateSqlDatabaseParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateSqlDatabaseParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlDatabaseWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (createUpdateSqlDatabaseParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlDatabaseParameters is required and cannot be null.")); + } else { + createUpdateSqlDatabaseParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + createUpdateSqlDatabaseParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlDatabaseGetResultsInner> + beginCreateUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + Mono>> mono = + createUpdateSqlDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlDatabaseGetResultsInner.class, + SqlDatabaseGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlDatabaseGetResultsInner> + beginCreateUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlDatabaseWithResponseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlDatabaseGetResultsInner.class, + SqlDatabaseGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlDatabaseGetResultsInner> beginCreateUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlDatabaseAsync( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return beginCreateUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return createUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @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 createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlDatabaseGetResultsInner createUpdateSqlDatabase( + String resourceGroupName, + String accountName, + String databaseName, + SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, + Context context) { + return createUpdateSqlDatabaseAsync( + resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlDatabaseWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlDatabase( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + deleteSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlDatabaseWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlDatabase( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlDatabaseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginDeleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context) { + deleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Gets the RUs per second of the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlDatabaseThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * Gets the RUs per second of the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + return getSqlDatabaseThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlDatabaseThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlDatabaseThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateSqlDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateSqlDatabaseThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlDatabaseThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateSqlDatabaseThroughputAsync( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscaleAsync(String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateSqlDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlDatabaseToAutoscaleWithResponseAsync(resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + return migrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateSqlDatabaseToAutoscaleAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlDatabaseToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlDatabaseToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + Mono>> mono = + migrateSqlDatabaseToManualThroughputWithResponseAsync(resourceGroupName, accountName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlDatabaseToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput(String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlDatabaseToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return beginMigrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + return migrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + return migrateSqlDatabaseToManualThroughputAsync(resourceGroupName, accountName, databaseName, context).block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlContainersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlContainersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlContainers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlContainersAsync( + String resourceGroupName, String accountName, String databaseName) { + return new PagedFlux<>(() -> listSqlContainersSinglePageAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlContainersAsync( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listSqlContainersSinglePageAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName) { + return new PagedIterable<>(listSqlContainersAsync(resourceGroupName, accountName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the containers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context) { + return new PagedIterable<>(listSqlContainersAsync(resourceGroupName, accountName, databaseName, context)); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return getSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlContainerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (createUpdateSqlContainerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlContainerParameters is required and cannot be null.")); + } else { + createUpdateSqlContainerParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + createUpdateSqlContainerParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlContainerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (createUpdateSqlContainerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlContainerParameters is required and cannot be null.")); + } else { + createUpdateSqlContainerParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + createUpdateSqlContainerParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + Mono>> mono = + createUpdateSqlContainerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlContainerGetResultsInner.class, + SqlContainerGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlContainerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlContainerGetResultsInner.class, + SqlContainerGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlContainerGetResultsInner> + beginCreateUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlContainerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return beginCreateUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerAsync( + resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlContainerGetResultsInner createUpdateSqlContainer( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, + Context context) { + return createUpdateSqlContainerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlContainerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlContainer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + deleteSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlContainerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlContainerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginDeleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + deleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + deleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlContainerThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlContainerThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithResponseAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return getSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlContainerThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateSqlContainerThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateSqlContainerThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateSqlContainerThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateSqlContainerThroughputAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateSqlContainerThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + migrateSqlContainerToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlContainerToAutoscaleWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToAutoscaleAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToAutoscaleAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToAutoscaleAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return migrateSqlContainerToAutoscaleAsync(resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateSqlContainerToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateSqlContainerToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + Mono>> mono = + migrateSqlContainerToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateSqlContainerToManualThroughputWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .getSyncPoller(); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateSqlContainerToManualThroughputAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return beginMigrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return migrateSqlContainerToManualThroughputAsync(resourceGroupName, accountName, databaseName, containerName) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return migrateSqlContainerToManualThroughputAsync( + resourceGroupName, accountName, databaseName, containerName, context) + .block(); + } + + /** + * Lists the SQL storedProcedure 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 ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlStoredProceduresSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL storedProcedure 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlStoredProceduresSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlStoredProcedures( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL storedProcedure 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 ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlStoredProceduresAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> listSqlStoredProceduresSinglePageAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL storedProcedure 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlStoredProceduresAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> + listSqlStoredProceduresSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL storedProcedure 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 ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>( + listSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL storedProcedure 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return getSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return getSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .block(); + } + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return getSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + if (createUpdateSqlStoredProcedureParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null.")); + } else { + createUpdateSqlStoredProcedureParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + createUpdateSqlStoredProcedureParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + if (createUpdateSqlStoredProcedureParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null.")); + } else { + createUpdateSqlStoredProcedureParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + createUpdateSqlStoredProcedureParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + Mono>> mono = + createUpdateSqlStoredProcedureWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlStoredProcedureGetResultsInner.class, + SqlStoredProcedureGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlStoredProcedureWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlStoredProcedureGetResultsInner.class, + SqlStoredProcedureGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlStoredProcedureGetResultsInner> + beginCreateUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return beginCreateUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return createUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB storedProcedure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, + Context context) { + return createUpdateSqlStoredProcedureAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlStoredProcedureWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (storedProcedureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlStoredProcedure( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + Mono>> mono = + deleteSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlStoredProcedureWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlStoredProcedureAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + return beginDeleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + deleteSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + deleteSqlStoredProcedureAsync( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .block(); + } + + /** + * Lists the SQL userDefinedFunction 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 ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlUserDefinedFunctionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL userDefinedFunction 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlUserDefinedFunctionsSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlUserDefinedFunctions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL userDefinedFunction 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 ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlUserDefinedFunctionsAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> + listSqlUserDefinedFunctionsSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL userDefinedFunction 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlUserDefinedFunctionsAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> + listSqlUserDefinedFunctionsSinglePageAsync( + resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL userDefinedFunction 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 ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>( + listSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL userDefinedFunction 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return getSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return getSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .block(); + } + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return getSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null.")); + } else { + createUpdateSqlUserDefinedFunctionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + createUpdateSqlUserDefinedFunctionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null.")); + } else { + createUpdateSqlUserDefinedFunctionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + createUpdateSqlUserDefinedFunctionParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + Mono>> mono = + createUpdateSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlUserDefinedFunctionGetResultsInner.class, + SqlUserDefinedFunctionGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlUserDefinedFunctionGetResultsInner.class, + SqlUserDefinedFunctionGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlUserDefinedFunctionGetResultsInner> + beginCreateUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return beginCreateUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return createUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB userDefinedFunction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, + Context context) { + return createUpdateSqlUserDefinedFunctionAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlUserDefinedFunctionWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (userDefinedFunctionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlUserDefinedFunction( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + Mono>> mono = + deleteSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlUserDefinedFunctionWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlUserDefinedFunctionAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + return beginDeleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + deleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + deleteSqlUserDefinedFunctionAsync( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .block(); + } + + /** + * Lists the SQL trigger 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 ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlTriggersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the SQL trigger 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlTriggersSinglePageAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlTriggers( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the SQL trigger 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 ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlTriggersAsync( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedFlux<>( + () -> listSqlTriggersSinglePageAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL trigger 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlTriggersAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedFlux<>( + () -> listSqlTriggersSinglePageAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Lists the SQL trigger 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 ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName) { + return new PagedIterable<>(listSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName)); + } + + /** + * Lists the SQL trigger 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the triggers and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + return new PagedIterable<>( + listSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName, context)); + } + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlTriggerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).block(); + } + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return getSqlTriggerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + if (createUpdateSqlTriggerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlTriggerParameters is required and cannot be null.")); + } else { + createUpdateSqlTriggerParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + createUpdateSqlTriggerParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + if (createUpdateSqlTriggerParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlTriggerParameters is required and cannot be null.")); + } else { + createUpdateSqlTriggerParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + createUpdateSqlTriggerParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlTriggerGetResultsInner> + beginCreateUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + Mono>> mono = + createUpdateSqlTriggerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlTriggerGetResultsInner.class, + SqlTriggerGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlTriggerGetResultsInner> + beginCreateUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlTriggerWithResponseAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlTriggerGetResultsInner.class, + SqlTriggerGetResultsInner.class, + context); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlTriggerGetResultsInner> beginCreateUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return beginCreateUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return createUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters) + .block(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB trigger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlTriggerGetResultsInner createUpdateSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, + Context context) { + return createUpdateSqlTriggerAsync( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlTriggerWithResponseAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlTriggerWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (triggerName == null) { + return Mono.error(new IllegalArgumentException("Parameter triggerName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteSqlTrigger( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + Mono>> mono = + deleteSqlTriggerWithResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlTriggerWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return beginDeleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return beginDeleteSqlTriggerAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlTriggerAsync( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return beginDeleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlTriggerAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + return beginDeleteSqlTriggerAsync( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + deleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + deleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + return getSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return getSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleDefinitionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleDefinitionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleDefinitionParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleDefinitionParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleDefinitionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleDefinitionParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + Mono>> mono = + createUpdateSqlRoleDefinitionWithResponseAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleDefinitionGetResultsInner.class, + SqlRoleDefinitionGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlRoleDefinitionWithResponseAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleDefinitionGetResultsInner.class, + SqlRoleDefinitionGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlRoleDefinitionGetResultsInner> + beginCreateUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleDefinitionAsync( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return beginCreateUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) { + return createUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters) + .block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleDefinitionParameters The properties required to create or update a Role Definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleDefinitionGetResultsInner createUpdateSqlRoleDefinition( + String roleDefinitionId, + String resourceGroupName, + String accountName, + SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, + Context context) { + return createUpdateSqlRoleDefinitionAsync( + roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleDefinitionWithResponseAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleDefinitionId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteSqlRoleDefinition( + this.client.getEndpoint(), + roleDefinitionId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + Mono>> mono = + deleteSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlRoleDefinitionWithResponseAsync(roleDefinitionId, resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleDefinitionAsync( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName) { + deleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + deleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleDefinitionsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlRoleDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleDefinitionsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlRoleDefinitions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleDefinitionsAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlRoleDefinitionsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleDefinitionsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlRoleDefinitionsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlRoleDefinitionsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlRoleDefinitionsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + return getSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).block(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return getSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName, context).block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleAssignmentParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleAssignmentParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleAssignmentParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleAssignmentParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (createUpdateSqlRoleAssignmentParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateSqlRoleAssignmentParameters is required and cannot be null.")); + } else { + createUpdateSqlRoleAssignmentParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + createUpdateSqlRoleAssignmentParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + Mono>> mono = + createUpdateSqlRoleAssignmentWithResponseAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleAssignmentGetResultsInner.class, + SqlRoleAssignmentGetResultsInner.class, + Context.NONE); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateSqlRoleAssignmentWithResponseAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SqlRoleAssignmentGetResultsInner.class, + SqlRoleAssignmentGetResultsInner.class, + context); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlRoleAssignmentGetResultsInner> + beginCreateUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateSqlRoleAssignmentAsync( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return beginCreateUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) { + return createUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters) + .block(); + } + + /** + * Creates or updates an Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateSqlRoleAssignmentParameters The properties required to create or update a Role Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlRoleAssignmentGetResultsInner createUpdateSqlRoleAssignment( + String roleAssignmentId, + String resourceGroupName, + String accountName, + SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, + Context context) { + return createUpdateSqlRoleAssignmentAsync( + roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteSqlRoleAssignmentWithResponseAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteSqlRoleAssignment( + this.client.getEndpoint(), + roleAssignmentId, + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + Mono>> mono = + deleteSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteSqlRoleAssignmentWithResponseAsync(roleAssignmentId, resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context) + .getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteSqlRoleAssignmentAsync( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + return beginDeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName) { + deleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + deleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, context).block(); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleAssignmentsSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSqlRoleAssignments( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSqlRoleAssignmentsSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSqlRoleAssignments( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleAssignmentsAsync( + String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSqlRoleAssignmentsSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSqlRoleAssignmentsAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSqlRoleAssignmentsSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName) { + return new PagedIterable<>(listSqlRoleAssignmentsAsync(resourceGroupName, accountName)); + } + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listSqlRoleAssignmentsAsync(resourceGroupName, accountName, context)); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } else { + location.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveContinuousBackupInformation( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + location, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retrieveContinuousBackupInformationWithResponseAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } else { + location.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveContinuousBackupInformation( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + databaseName, + containerName, + this.client.getApiVersion(), + location, + accept, + context); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + Mono>> mono = + retrieveContinuousBackupInformationWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, location); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInformationInner.class, + BackupInformationInner.class, + Context.NONE); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupInformationInner> + beginRetrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + retrieveContinuousBackupInformationWithResponseAsync( + resourceGroupName, accountName, databaseName, containerName, location, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupInformationInner.class, + BackupInformationInner.class, + context); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupInformationInner> + beginRetrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .getSyncPoller(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveContinuousBackupInformationAsync( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return beginRetrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + return retrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location) + .block(); + } + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupInformationInner retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + return retrieveContinuousBackupInformationAsync( + resourceGroupName, accountName, databaseName, containerName, location, context) + .block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java new file mode 100644 index 0000000000000..a71c1a8287a7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlResourcesImpl.java @@ -0,0 +1,1826 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.SqlResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.BackupInformation; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlResources; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SqlResourcesImpl implements SqlResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlResourcesImpl.class); + + private final SqlResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public SqlResourcesImpl( + SqlResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSqlDatabases(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlDatabases(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlDatabaseGetResultsImpl(inner1, this.manager())); + } + + public SqlDatabaseGetResults getSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + SqlDatabaseGetResultsInner inner = + this.serviceClient().getSqlDatabase(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new SqlDatabaseGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this.serviceClient().getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlDatabaseGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + this.serviceClient().deleteSqlDatabase(resourceGroupName, accountName, databaseName); + } + + public void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context) { + this.serviceClient().deleteSqlDatabase(resourceGroupName, accountName, databaseName, context); + } + + public ThroughputSettingsGetResults getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getSqlDatabaseThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context) { + Response inner = + this + .serviceClient() + .getSqlDatabaseThroughputWithResponse(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlDatabaseThroughput(resourceGroupName, accountName, databaseName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlDatabaseThroughput( + resourceGroupName, accountName, databaseName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToAutoscale(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToAutoscale(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateSqlDatabaseToManualThroughput(resourceGroupName, accountName, databaseName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlDatabaseToManualThroughput(resourceGroupName, accountName, databaseName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName) { + PagedIterable inner = + this.serviceClient().listSqlContainers(resourceGroupName, accountName, databaseName); + return Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlContainers(resourceGroupName, accountName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SqlContainerGetResultsImpl(inner1, this.manager())); + } + + public SqlContainerGetResults getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlContainerGetResultsInner inner = + this.serviceClient().getSqlContainer(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new SqlContainerGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + Response inner = + this + .serviceClient() + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlContainerGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + this.serviceClient().deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName); + } + + public void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + this.serviceClient().deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, context); + } + + public ThroughputSettingsGetResults getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getSqlContainerThroughput(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + Response inner = + this + .serviceClient() + .getSqlContainerThroughputWithResponse( + resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlContainerThroughput( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateSqlContainerThroughput( + resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToAutoscale(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToAutoscale(resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToManualThroughput(resourceGroupName, accountName, databaseName, containerName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .migrateSqlContainerToManualThroughput( + resourceGroupName, accountName, databaseName, containerName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this.serviceClient().listSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlStoredProcedures(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlStoredProcedureGetResultsImpl(inner1, this.manager())); + } + + public SqlStoredProcedureGetResults getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + SqlStoredProcedureGetResultsInner inner = + this + .serviceClient() + .getSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + if (inner != null) { + return new SqlStoredProcedureGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlStoredProcedureGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName) { + this + .serviceClient() + .deleteSqlStoredProcedure(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + } + + public void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context) { + this + .serviceClient() + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this + .serviceClient() + .listSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listSqlUserDefinedFunctions(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlUserDefinedFunctionGetResultsImpl(inner1, this.manager())); + } + + public SqlUserDefinedFunctionGetResults getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + SqlUserDefinedFunctionGetResultsInner inner = + this + .serviceClient() + .getSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + if (inner != null) { + return new SqlUserDefinedFunctionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlUserDefinedFunctionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName) { + this + .serviceClient() + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + } + + public void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context) { + this + .serviceClient() + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName) { + PagedIterable inner = + this.serviceClient().listSqlTriggers(resourceGroupName, accountName, databaseName, containerName); + return Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlTriggers(resourceGroupName, accountName, databaseName, containerName, context); + return Utils.mapPage(inner, inner1 -> new SqlTriggerGetResultsImpl(inner1, this.manager())); + } + + public SqlTriggerGetResults getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + SqlTriggerGetResultsInner inner = + this + .serviceClient() + .getSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName); + if (inner != null) { + return new SqlTriggerGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + Response inner = + this + .serviceClient() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlTriggerGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + this.serviceClient().deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName); + } + + public void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context) { + this + .serviceClient() + .deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public SqlRoleDefinitionGetResults getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName) { + SqlRoleDefinitionGetResultsInner inner = + this.serviceClient().getSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName); + if (inner != null) { + return new SqlRoleDefinitionGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + Response inner = + this + .serviceClient() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlRoleDefinitionGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName) { + this.serviceClient().deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName); + } + + public void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context) { + this.serviceClient().deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, context); + } + + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlRoleDefinitions(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleDefinitions(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleDefinitionGetResultsImpl(inner1, this.manager())); + } + + public SqlRoleAssignmentGetResults getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName) { + SqlRoleAssignmentGetResultsInner inner = + this.serviceClient().getSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName); + if (inner != null) { + return new SqlRoleAssignmentGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + Response inner = + this + .serviceClient() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlRoleAssignmentGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName) { + this.serviceClient().deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName); + } + + public void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context) { + this.serviceClient().deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, context); + } + + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listSqlRoleAssignments(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listSqlRoleAssignments(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new SqlRoleAssignmentGetResultsImpl(inner1, this.manager())); + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context) { + BackupInformationInner inner = + this + .serviceClient() + .retrieveContinuousBackupInformation( + resourceGroupName, accountName, databaseName, containerName, location, context); + if (inner != null) { + return new BackupInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlDatabaseGetResults getSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, Context.NONE).getValue(); + } + + public Response getSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + return this.getSqlDatabaseWithResponse(resourceGroupName, accountName, databaseName, context); + } + + public SqlContainerGetResults getSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this + .getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, Context.NONE) + .getValue(); + } + + public Response getSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + return this.getSqlContainerWithResponse(resourceGroupName, accountName, databaseName, containerName, context); + } + + public SqlStoredProcedureGetResults getSqlStoredProcedureById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE) + .getValue(); + } + + public Response getSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + return this + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public SqlUserDefinedFunctionGetResults getSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE) + .getValue(); + } + + public Response getSqlUserDefinedFunctionByIdWithResponse( + String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + return this + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public SqlTriggerGetResults getSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE) + .getValue(); + } + + public Response getSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + return this + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public SqlRoleDefinitionGetResults getSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context); + } + + public SqlRoleAssignmentGetResults getSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + } + + public Response getSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + return this.getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context); + } + + public void deleteSqlDatabaseById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, Context.NONE); + } + + public void deleteSqlDatabaseByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + this.deleteSqlDatabase(resourceGroupName, accountName, databaseName, context); + } + + public void deleteSqlContainerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, Context.NONE); + } + + public void deleteSqlContainerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + this.deleteSqlContainer(resourceGroupName, accountName, databaseName, containerName, context); + } + + public void deleteSqlStoredProcedureById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE); + } + + public void deleteSqlStoredProcedureByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String storedProcedureName = Utils.getValueFromIdByName(id, "storedProcedures"); + if (storedProcedureName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storedProcedures'.", id))); + } + this + .deleteSqlStoredProcedure( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context); + } + + public void deleteSqlUserDefinedFunctionById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE); + } + + public void deleteSqlUserDefinedFunctionByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String userDefinedFunctionName = Utils.getValueFromIdByName(id, "userDefinedFunctions"); + if (userDefinedFunctionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userDefinedFunctions'.", + id))); + } + this + .deleteSqlUserDefinedFunction( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context); + } + + public void deleteSqlTriggerById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE); + } + + public void deleteSqlTriggerByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "sqlDatabases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlDatabases'.", id))); + } + String containerName = Utils.getValueFromIdByName(id, "containers"); + if (containerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'containers'.", id))); + } + String triggerName = Utils.getValueFromIdByName(id, "triggers"); + if (triggerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id))); + } + this.deleteSqlTrigger(resourceGroupName, accountName, databaseName, containerName, triggerName, context); + } + + public void deleteSqlRoleDefinitionById(String id) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleDefinitionByIdWithResponse(String id, Context context) { + String roleDefinitionId = Utils.getValueFromIdByName(id, "sqlRoleDefinitions"); + if (roleDefinitionId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleDefinitions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, context); + } + + public void deleteSqlRoleAssignmentById(String id) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, Context.NONE); + } + + public void deleteSqlRoleAssignmentByIdWithResponse(String id, Context context) { + String roleAssignmentId = Utils.getValueFromIdByName(id, "sqlRoleAssignments"); + if (roleAssignmentId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'sqlRoleAssignments'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + this.deleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, context); + } + + private SqlResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public SqlDatabaseGetResultsImpl defineUpdateSqlDatabase(String name) { + return new SqlDatabaseGetResultsImpl(name, this.manager()); + } + + public SqlContainerGetResultsImpl defineUpdateSqlContainer(String name) { + return new SqlContainerGetResultsImpl(name, this.manager()); + } + + public SqlStoredProcedureGetResultsImpl defineUpdateSqlStoredProcedure(String name) { + return new SqlStoredProcedureGetResultsImpl(name, this.manager()); + } + + public SqlUserDefinedFunctionGetResultsImpl defineUpdateSqlUserDefinedFunction(String name) { + return new SqlUserDefinedFunctionGetResultsImpl(name, this.manager()); + } + + public SqlTriggerGetResultsImpl defineUpdateSqlTrigger(String name) { + return new SqlTriggerGetResultsImpl(name, this.manager()); + } + + public SqlRoleDefinitionGetResultsImpl defineUpdateSqlRoleDefinition(String name) { + return new SqlRoleDefinitionGetResultsImpl(name, this.manager()); + } + + public SqlRoleAssignmentGetResultsImpl defineUpdateSqlRoleAssignment(String name) { + return new SqlRoleAssignmentGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java new file mode 100644 index 0000000000000..abd15496cb7c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleAssignmentGetResultsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleAssignmentGetResults; + +public final class SqlRoleAssignmentGetResultsImpl + implements SqlRoleAssignmentGetResults, SqlRoleAssignmentGetResults.Definition, SqlRoleAssignmentGetResults.Update { + private SqlRoleAssignmentGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String roleDefinitionId() { + return this.innerModel().roleDefinitionId(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public String principalId() { + return this.innerModel().principalId(); + } + + public SqlRoleAssignmentGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String roleAssignmentId; + + private String resourceGroupName; + + private String accountName; + + private SqlRoleAssignmentCreateUpdateParameters createCreateUpdateSqlRoleAssignmentParameters; + + private SqlRoleAssignmentCreateUpdateParameters updateCreateUpdateSqlRoleAssignmentParameters; + + public SqlRoleAssignmentGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public SqlRoleAssignmentGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleAssignmentParameters, + Context.NONE); + return this; + } + + public SqlRoleAssignmentGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleAssignmentParameters, + context); + return this; + } + + SqlRoleAssignmentGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlRoleAssignmentGetResultsInner(); + this.serviceManager = serviceManager; + this.roleAssignmentId = name; + this.createCreateUpdateSqlRoleAssignmentParameters = new SqlRoleAssignmentCreateUpdateParameters(); + } + + public SqlRoleAssignmentGetResultsImpl update() { + this.updateCreateUpdateSqlRoleAssignmentParameters = new SqlRoleAssignmentCreateUpdateParameters(); + return this; + } + + public SqlRoleAssignmentGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleAssignmentParameters, + Context.NONE); + return this; + } + + public SqlRoleAssignmentGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + roleAssignmentId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleAssignmentParameters, + context); + return this; + } + + SqlRoleAssignmentGetResultsImpl( + SqlRoleAssignmentGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.roleAssignmentId = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleAssignments"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleAssignmentGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse(roleAssignmentId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleAssignmentGetResultsImpl withRoleDefinitionId(String roleDefinitionId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withScope(String scope) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withScope(scope); + return this; + } + } + + public SqlRoleAssignmentGetResultsImpl withPrincipalId(String principalId) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } else { + this.updateCreateUpdateSqlRoleAssignmentParameters.withPrincipalId(principalId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java new file mode 100644 index 0000000000000..a5343871369a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlRoleDefinitionGetResultsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlRoleDefinitionGetResults; +import java.util.Collections; +import java.util.List; + +public final class SqlRoleDefinitionGetResultsImpl + implements SqlRoleDefinitionGetResults, SqlRoleDefinitionGetResults.Definition, SqlRoleDefinitionGetResults.Update { + private SqlRoleDefinitionGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String roleName() { + return this.innerModel().roleName(); + } + + public RoleDefinitionType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public List assignableScopes() { + List inner = this.innerModel().assignableScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List permissions() { + List inner = this.innerModel().permissions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlRoleDefinitionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String roleDefinitionId; + + private String resourceGroupName; + + private String accountName; + + private SqlRoleDefinitionCreateUpdateParameters createCreateUpdateSqlRoleDefinitionParameters; + + private SqlRoleDefinitionCreateUpdateParameters updateCreateUpdateSqlRoleDefinitionParameters; + + public SqlRoleDefinitionGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public SqlRoleDefinitionGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleDefinitionParameters, + Context.NONE); + return this; + } + + public SqlRoleDefinitionGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + createCreateUpdateSqlRoleDefinitionParameters, + context); + return this; + } + + SqlRoleDefinitionGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlRoleDefinitionGetResultsInner(); + this.serviceManager = serviceManager; + this.roleDefinitionId = name; + this.createCreateUpdateSqlRoleDefinitionParameters = new SqlRoleDefinitionCreateUpdateParameters(); + } + + public SqlRoleDefinitionGetResultsImpl update() { + this.updateCreateUpdateSqlRoleDefinitionParameters = new SqlRoleDefinitionCreateUpdateParameters(); + return this; + } + + public SqlRoleDefinitionGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleDefinitionParameters, + Context.NONE); + return this; + } + + public SqlRoleDefinitionGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + roleDefinitionId, + resourceGroupName, + accountName, + updateCreateUpdateSqlRoleDefinitionParameters, + context); + return this; + } + + SqlRoleDefinitionGetResultsImpl( + SqlRoleDefinitionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.roleDefinitionId = Utils.getValueFromIdByName(innerObject.id(), "sqlRoleDefinitions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + } + + public SqlRoleDefinitionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse(roleDefinitionId, resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public SqlRoleDefinitionGetResultsImpl withRoleName(String roleName) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withRoleName(roleName); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withType(RoleDefinitionType type) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withType(type); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withAssignableScopes(List assignableScopes) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withAssignableScopes(assignableScopes); + return this; + } + } + + public SqlRoleDefinitionGetResultsImpl withPermissions(List permissions) { + if (isInCreateMode()) { + this.createCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } else { + this.updateCreateUpdateSqlRoleDefinitionParameters.withPermissions(permissions); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java new file mode 100644 index 0000000000000..d532e8596c1b3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlStoredProcedureGetResultsImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; +import java.util.Collections; +import java.util.Map; + +public final class SqlStoredProcedureGetResultsImpl + implements SqlStoredProcedureGetResults, + SqlStoredProcedureGetResults.Definition, + SqlStoredProcedureGetResults.Update { + private SqlStoredProcedureGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SqlStoredProcedureGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlStoredProcedureGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String containerName; + + private String storedProcedureName; + + private SqlStoredProcedureCreateUpdateParameters createCreateUpdateSqlStoredProcedureParameters; + + private SqlStoredProcedureCreateUpdateParameters updateCreateUpdateSqlStoredProcedureParameters; + + public SqlStoredProcedureGetResultsImpl withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + public SqlStoredProcedureGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlStoredProcedure( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createCreateUpdateSqlStoredProcedureParameters, + Context.NONE); + return this; + } + + public SqlStoredProcedureGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlStoredProcedure( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createCreateUpdateSqlStoredProcedureParameters, + context); + return this; + } + + SqlStoredProcedureGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlStoredProcedureGetResultsInner(); + this.serviceManager = serviceManager; + this.storedProcedureName = name; + this.createCreateUpdateSqlStoredProcedureParameters = new SqlStoredProcedureCreateUpdateParameters(); + } + + public SqlStoredProcedureGetResultsImpl update() { + this.updateCreateUpdateSqlStoredProcedureParameters = new SqlStoredProcedureCreateUpdateParameters(); + return this; + } + + public SqlStoredProcedureGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlStoredProcedure( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + updateCreateUpdateSqlStoredProcedureParameters, + Context.NONE); + return this; + } + + public SqlStoredProcedureGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlStoredProcedure( + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + updateCreateUpdateSqlStoredProcedureParameters, + context); + return this; + } + + SqlStoredProcedureGetResultsImpl( + SqlStoredProcedureGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.storedProcedureName = Utils.getValueFromIdByName(innerObject.id(), "storedProcedures"); + } + + public SqlStoredProcedureGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, Context.NONE) + .getValue(); + return this; + } + + public SqlStoredProcedureGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlStoredProcedureWithResponse( + resourceGroupName, accountName, databaseName, containerName, storedProcedureName, context) + .getValue(); + return this; + } + + public SqlStoredProcedureGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlStoredProcedureParameters.withLocation(location.toString()); + return this; + } + + public SqlStoredProcedureGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlStoredProcedureParameters.withLocation(location); + return this; + } + + public SqlStoredProcedureGetResultsImpl withResource(SqlStoredProcedureResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withResource(resource); + return this; + } + } + + public SqlStoredProcedureGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withTags(tags); + return this; + } + } + + public SqlStoredProcedureGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withIdentity(identity); + return this; + } + } + + public SqlStoredProcedureGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateSqlStoredProcedureParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateSqlStoredProcedureParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.java new file mode 100644 index 0000000000000..0793decfb9a25 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlTriggerGetResultsImpl.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import java.util.Collections; +import java.util.Map; + +public final class SqlTriggerGetResultsImpl + implements SqlTriggerGetResults, SqlTriggerGetResults.Definition, SqlTriggerGetResults.Update { + private SqlTriggerGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SqlTriggerGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlTriggerGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String containerName; + + private String triggerName; + + private SqlTriggerCreateUpdateParameters createCreateUpdateSqlTriggerParameters; + + private SqlTriggerCreateUpdateParameters updateCreateUpdateSqlTriggerParameters; + + public SqlTriggerGetResultsImpl withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + public SqlTriggerGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlTrigger( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createCreateUpdateSqlTriggerParameters, + Context.NONE); + return this; + } + + public SqlTriggerGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlTrigger( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createCreateUpdateSqlTriggerParameters, + context); + return this; + } + + SqlTriggerGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlTriggerGetResultsInner(); + this.serviceManager = serviceManager; + this.triggerName = name; + this.createCreateUpdateSqlTriggerParameters = new SqlTriggerCreateUpdateParameters(); + } + + public SqlTriggerGetResultsImpl update() { + this.updateCreateUpdateSqlTriggerParameters = new SqlTriggerCreateUpdateParameters(); + return this; + } + + public SqlTriggerGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlTrigger( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + updateCreateUpdateSqlTriggerParameters, + Context.NONE); + return this; + } + + public SqlTriggerGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlTrigger( + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + updateCreateUpdateSqlTriggerParameters, + context); + return this; + } + + SqlTriggerGetResultsImpl( + SqlTriggerGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.triggerName = Utils.getValueFromIdByName(innerObject.id(), "triggers"); + } + + public SqlTriggerGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, Context.NONE) + .getValue(); + return this; + } + + public SqlTriggerGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlTriggerWithResponse( + resourceGroupName, accountName, databaseName, containerName, triggerName, context) + .getValue(); + return this; + } + + public SqlTriggerGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlTriggerParameters.withLocation(location.toString()); + return this; + } + + public SqlTriggerGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlTriggerParameters.withLocation(location); + return this; + } + + public SqlTriggerGetResultsImpl withResource(SqlTriggerResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withResource(resource); + return this; + } + } + + public SqlTriggerGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withTags(tags); + return this; + } + } + + public SqlTriggerGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withIdentity(identity); + return this; + } + } + + public SqlTriggerGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateSqlTriggerParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateSqlTriggerParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.java new file mode 100644 index 0000000000000..db1b73a2b37a2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/SqlUserDefinedFunctionGetResultsImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionGetResults; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; +import java.util.Collections; +import java.util.Map; + +public final class SqlUserDefinedFunctionGetResultsImpl + implements SqlUserDefinedFunctionGetResults, + SqlUserDefinedFunctionGetResults.Definition, + SqlUserDefinedFunctionGetResults.Update { + private SqlUserDefinedFunctionGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SqlUserDefinedFunctionGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String databaseName; + + private String containerName; + + private String userDefinedFunctionName; + + private SqlUserDefinedFunctionCreateUpdateParameters createCreateUpdateSqlUserDefinedFunctionParameters; + + private SqlUserDefinedFunctionCreateUpdateParameters updateCreateUpdateSqlUserDefinedFunctionParameters; + + public SqlUserDefinedFunctionGetResultsImpl withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + public SqlUserDefinedFunctionGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlUserDefinedFunction( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createCreateUpdateSqlUserDefinedFunctionParameters, + Context.NONE); + return this; + } + + public SqlUserDefinedFunctionGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlUserDefinedFunction( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createCreateUpdateSqlUserDefinedFunctionParameters, + context); + return this; + } + + SqlUserDefinedFunctionGetResultsImpl( + String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new SqlUserDefinedFunctionGetResultsInner(); + this.serviceManager = serviceManager; + this.userDefinedFunctionName = name; + this.createCreateUpdateSqlUserDefinedFunctionParameters = new SqlUserDefinedFunctionCreateUpdateParameters(); + } + + public SqlUserDefinedFunctionGetResultsImpl update() { + this.updateCreateUpdateSqlUserDefinedFunctionParameters = new SqlUserDefinedFunctionCreateUpdateParameters(); + return this; + } + + public SqlUserDefinedFunctionGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlUserDefinedFunction( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + updateCreateUpdateSqlUserDefinedFunctionParameters, + Context.NONE); + return this; + } + + public SqlUserDefinedFunctionGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .createUpdateSqlUserDefinedFunction( + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + updateCreateUpdateSqlUserDefinedFunctionParameters, + context); + return this; + } + + SqlUserDefinedFunctionGetResultsImpl( + SqlUserDefinedFunctionGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "sqlDatabases"); + this.containerName = Utils.getValueFromIdByName(innerObject.id(), "containers"); + this.userDefinedFunctionName = Utils.getValueFromIdByName(innerObject.id(), "userDefinedFunctions"); + } + + public SqlUserDefinedFunctionGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, Context.NONE) + .getValue(); + return this; + } + + public SqlUserDefinedFunctionGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlResources() + .getSqlUserDefinedFunctionWithResponse( + resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, context) + .getValue(); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withRegion(Region location) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withLocation(location.toString()); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withRegion(String location) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withLocation(location); + return this; + } + + public SqlUserDefinedFunctionGetResultsImpl withResource(SqlUserDefinedFunctionResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withResource(resource); + return this; + } + } + + public SqlUserDefinedFunctionGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withTags(tags); + return this; + } + } + + public SqlUserDefinedFunctionGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withIdentity(identity); + return this; + } + } + + public SqlUserDefinedFunctionGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateSqlUserDefinedFunctionParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateSqlUserDefinedFunctionParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java new file mode 100644 index 0000000000000..bbf0d04f36c9c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableGetResultsImpl.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.TableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import java.util.Collections; +import java.util.Map; + +public final class TableGetResultsImpl implements TableGetResults, TableGetResults.Definition, TableGetResults.Update { + private TableGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public TableGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public TableGetPropertiesOptions options() { + return this.innerModel().options(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public TableGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String tableName; + + private TableCreateUpdateParameters createCreateUpdateTableParameters; + + private TableCreateUpdateParameters updateCreateUpdateTableParameters; + + public TableGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public TableGetResults create() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, createCreateUpdateTableParameters, Context.NONE); + return this; + } + + public TableGetResults create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, createCreateUpdateTableParameters, context); + return this; + } + + TableGetResultsImpl(String name, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = new TableGetResultsInner(); + this.serviceManager = serviceManager; + this.tableName = name; + this.createCreateUpdateTableParameters = new TableCreateUpdateParameters(); + } + + public TableGetResultsImpl update() { + this.updateCreateUpdateTableParameters = new TableCreateUpdateParameters(); + return this; + } + + public TableGetResults apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, updateCreateUpdateTableParameters, Context.NONE); + return this; + } + + public TableGetResults apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .createUpdateTable( + resourceGroupName, accountName, tableName, updateCreateUpdateTableParameters, context); + return this; + } + + TableGetResultsImpl( + TableGetResultsInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "databaseAccounts"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + } + + public TableGetResults refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE) + .getValue(); + return this; + } + + public TableGetResults refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTableResources() + .getTableWithResponse(resourceGroupName, accountName, tableName, context) + .getValue(); + return this; + } + + public TableGetResultsImpl withRegion(Region location) { + this.createCreateUpdateTableParameters.withLocation(location.toString()); + return this; + } + + public TableGetResultsImpl withRegion(String location) { + this.createCreateUpdateTableParameters.withLocation(location); + return this; + } + + public TableGetResultsImpl withResource(TableResource resource) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withResource(resource); + return this; + } else { + this.updateCreateUpdateTableParameters.withResource(resource); + return this; + } + } + + public TableGetResultsImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withTags(tags); + return this; + } else { + this.updateCreateUpdateTableParameters.withTags(tags); + return this; + } + } + + public TableGetResultsImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withIdentity(identity); + return this; + } else { + this.updateCreateUpdateTableParameters.withIdentity(identity); + return this; + } + } + + public TableGetResultsImpl withOptions(CreateUpdateOptions options) { + if (isInCreateMode()) { + this.createCreateUpdateTableParameters.withOptions(options); + return this; + } else { + this.updateCreateUpdateTableParameters.withOptions(options); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java new file mode 100644 index 0000000000000..ec30ae3d7b598 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesClientImpl.java @@ -0,0 +1,2160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.generated.models.TableListResult; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TableResourcesClient. */ +public final class TableResourcesClientImpl implements TableResourcesClient { + private final ClientLogger logger = new ClientLogger(TableResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TableResourcesService service; + + /** The service client containing this operation class. */ + private final CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of TableResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TableResourcesClientImpl(CosmosDBManagementClientImpl client) { + this.service = + RestProxy.create(TableResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CosmosDBManagementClientTableResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CosmosDBManagementCl") + private interface TableResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTables( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdateTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TableCreateUpdateParameters createUpdateTableParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteTable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTableThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ThroughputSettingsUpdateParameters updateThroughputParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateTableToAutoscale( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB" + + "/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default" + + "/migrateToManualThroughput") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> migrateTableToManualThroughput( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("tableName") String tableName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Tables 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTablesSinglePageAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Tables 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTablesSinglePageAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTables( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Tables 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTablesAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listTablesSinglePageAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Tables 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listTablesAsync( + String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listTablesSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * Lists the Tables 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTables(String resourceGroupName, String accountName) { + return new PagedIterable<>(listTablesAsync(resourceGroupName, accountName)); + } + + /** + * Lists the Tables 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 operation response, that contains the Table and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTables( + String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listTablesAsync(resourceGroupName, accountName, context)); + } + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableAsync(String resourceGroupName, String accountName, String tableName) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner getTable(String resourceGroupName, String accountName, String tableName) { + return getTableAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + return getTableWithResponseAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateTableWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateTableParameters is required and cannot be null.")); + } else { + createUpdateTableParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + createUpdateTableParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateTableWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (createUpdateTableParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createUpdateTableParameters is required and cannot be null.")); + } else { + createUpdateTableParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdateTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + createUpdateTableParameters, + accept, + context); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TableGetResultsInner> beginCreateUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + Mono>> mono = + createUpdateTableWithResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TableGetResultsInner.class, + TableGetResultsInner.class, + Context.NONE); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TableGetResultsInner> beginCreateUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateTableWithResponseAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TableGetResultsInner.class, TableGetResultsInner.class, context); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TableGetResultsInner> beginCreateUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return beginCreateUpdateTableAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .getSyncPoller(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateTableAsync( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return beginCreateUpdateTableAsync( + resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters) { + return createUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).block(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @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 createUpdateTableParameters The parameters to provide for the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableGetResultsInner createUpdateTable( + String resourceGroupName, + String accountName, + String tableName, + TableCreateUpdateParameters createUpdateTableParameters, + Context context) { + return createUpdateTableAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters, context) + .block(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteTableWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .deleteTable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteTableAsync( + String resourceGroupName, String accountName, String tableName) { + Mono>> mono = deleteTableWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteTableAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteTableWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteTable( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName, context).getSyncPoller(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteTableAsync(String resourceGroupName, String accountName, String tableName) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteTableAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginDeleteTableAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTable(String resourceGroupName, String accountName, String tableName) { + deleteTableAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTable(String resourceGroupName, String accountName, String tableName, Context context) { + deleteTableAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTableThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTableThroughputAsync( + String resourceGroupName, String accountName, String tableName) { + return getTableThroughputWithResponseAsync(resourceGroupName, accountName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner getTableThroughput( + String resourceGroupName, String accountName, String tableName) { + return getTableThroughputAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + return getTableThroughputWithResponseAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTableThroughputWithResponseAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (updateThroughputParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateThroughputParameters is required and cannot be null.")); + } else { + updateThroughputParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTableThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + updateThroughputParameters, + accept, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + Mono>> mono = + updateTableThroughputWithResponseAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateTableThroughputWithResponseAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginUpdateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .getSyncPoller(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTableThroughputAsync( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return beginUpdateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .block(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + return updateTableThroughputAsync( + resourceGroupName, accountName, tableName, updateThroughputParameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToAutoscaleWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToAutoscale( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscaleAsync(String resourceGroupName, String accountName, String tableName) { + Mono>> mono = + migrateTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateTableToAutoscaleWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToAutoscale(String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToAutoscaleAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName) { + return migrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context) { + return migrateTableToAutoscaleAsync(resourceGroupName, accountName, tableName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> migrateTableToManualThroughputWithResponseAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrateTableToManualThroughput( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + tableName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughputAsync(String resourceGroupName, String accountName, String tableName) { + Mono>> mono = + migrateTableToManualThroughputWithResponseAsync(resourceGroupName, accountName, tableName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + Context.NONE); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + migrateTableToManualThroughputWithResponseAsync(resourceGroupName, accountName, tableName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ThroughputSettingsGetResultsInner.class, + ThroughputSettingsGetResultsInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput(String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ThroughputSettingsGetResultsInner> + beginMigrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateTableToManualThroughputAsync( + String resourceGroupName, String accountName, String tableName, Context context) { + return beginMigrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName) { + return migrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThroughputSettingsGetResultsInner migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + return migrateTableToManualThroughputAsync(resourceGroupName, accountName, tableName, context).block(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java new file mode 100644 index 0000000000000..7b153c1a89d3d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/TableResourcesImpl.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.TableResourcesClient; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.TableGetResults; +import com.azure.resourcemanager.cosmos.generated.models.TableResources; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TableResourcesImpl implements TableResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableResourcesImpl.class); + + private final TableResourcesClient innerClient; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + public TableResourcesImpl( + TableResourcesClient innerClient, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listTables(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listTables(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public PagedIterable listTables(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = + this.serviceClient().listTables(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new TableGetResultsImpl(inner1, this.manager())); + } + + public TableGetResults getTable(String resourceGroupName, String accountName, String tableName) { + TableGetResultsInner inner = this.serviceClient().getTable(resourceGroupName, accountName, tableName); + if (inner != null) { + return new TableGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + Response inner = + this.serviceClient().getTableWithResponse(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TableGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteTable(String resourceGroupName, String accountName, String tableName) { + this.serviceClient().deleteTable(resourceGroupName, accountName, tableName); + } + + public void deleteTable(String resourceGroupName, String accountName, String tableName, Context context) { + this.serviceClient().deleteTable(resourceGroupName, accountName, tableName, context); + } + + public ThroughputSettingsGetResults getTableThroughput( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().getTableThroughput(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context) { + Response inner = + this.serviceClient().getTableThroughputWithResponse(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ThroughputSettingsGetResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateTableThroughput(resourceGroupName, accountName, tableName, updateThroughputParameters); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context) { + ThroughputSettingsGetResultsInner inner = + this + .serviceClient() + .updateTableThroughput(resourceGroupName, accountName, tableName, updateThroughputParameters, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToAutoscale(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToAutoscale(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToManualThroughput(resourceGroupName, accountName, tableName); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context) { + ThroughputSettingsGetResultsInner inner = + this.serviceClient().migrateTableToManualThroughput(resourceGroupName, accountName, tableName, context); + if (inner != null) { + return new ThroughputSettingsGetResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public TableGetResults getTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, Context.NONE).getValue(); + } + + public Response getTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + return this.getTableWithResponse(resourceGroupName, accountName, tableName, context); + } + + public void deleteTableById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, Context.NONE); + } + + public void deleteTableByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "databaseAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'databaseAccounts'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + this.deleteTable(resourceGroupName, accountName, tableName, context); + } + + private TableResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } + + public TableGetResultsImpl define(String name) { + return new TableGetResultsImpl(name, this.manager()); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java new file mode 100644 index 0000000000000..7012677a654fe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/ThroughputSettingsGetResultsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetPropertiesResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsGetResults; +import java.util.Collections; +import java.util.Map; + +public final class ThroughputSettingsGetResultsImpl implements ThroughputSettingsGetResults { + private ThroughputSettingsGetResultsInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + ThroughputSettingsGetResultsImpl( + ThroughputSettingsGetResultsInner innerObject, + com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public ThroughputSettingsGetPropertiesResource resource() { + return this.innerModel().resource(); + } + + public ThroughputSettingsGetResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/UsageImpl.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/UsageImpl.java new file mode 100644 index 0000000000000..54c0ef384a184 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/UsageImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.cosmos.generated.models.MetricName; +import com.azure.resourcemanager.cosmos.generated.models.UnitType; +import com.azure.resourcemanager.cosmos.generated.models.Usage; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager; + + UsageImpl(UsageInner innerObject, com.azure.resourcemanager.cosmos.generated.CosmosDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public String quotaPeriod() { + return this.innerModel().quotaPeriod(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.java new file mode 100644 index 0000000000000..53dcdaab87f69 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java new file mode 100644 index 0000000000000..a96d554f105df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource + * Provider REST API. + */ +package com.azure.resourcemanager.cosmos.generated.implementation; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java new file mode 100644 index 0000000000000..47ed2b1272ac5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageConfiguration.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Analytical storage specific properties. */ +@Fluent +public final class AnalyticalStorageConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalyticalStorageConfiguration.class); + + /* + * Describes the types of schema for analytical storage. + */ + @JsonProperty(value = "schemaType") + private AnalyticalStorageSchemaType schemaType; + + /** + * Get the schemaType property: Describes the types of schema for analytical storage. + * + * @return the schemaType value. + */ + public AnalyticalStorageSchemaType schemaType() { + return this.schemaType; + } + + /** + * Set the schemaType property: Describes the types of schema for analytical storage. + * + * @param schemaType the schemaType value to set. + * @return the AnalyticalStorageConfiguration object itself. + */ + public AnalyticalStorageConfiguration withSchemaType(AnalyticalStorageSchemaType schemaType) { + this.schemaType = schemaType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java new file mode 100644 index 0000000000000..cc0cd84f4f29b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AnalyticalStorageSchemaType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AnalyticalStorageSchemaType. */ +public final class AnalyticalStorageSchemaType extends ExpandableStringEnum { + /** Static value WellDefined for AnalyticalStorageSchemaType. */ + public static final AnalyticalStorageSchemaType WELL_DEFINED = fromString("WellDefined"); + + /** Static value FullFidelity for AnalyticalStorageSchemaType. */ + public static final AnalyticalStorageSchemaType FULL_FIDELITY = fromString("FullFidelity"); + + /** + * Creates or finds a AnalyticalStorageSchemaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalyticalStorageSchemaType. + */ + @JsonCreator + public static AnalyticalStorageSchemaType fromString(String name) { + return fromString(name, AnalyticalStorageSchemaType.class); + } + + /** @return known AnalyticalStorageSchemaType values. */ + public static Collection values() { + return values(AnalyticalStorageSchemaType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java new file mode 100644 index 0000000000000..754bf62b1b0a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiProperties model. */ +@Fluent +public final class ApiProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiProperties.class); + + /* + * Describes the ServerVersion of an a MongoDB account. + */ + @JsonProperty(value = "serverVersion") + private ServerVersion serverVersion; + + /** + * Get the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @return the serverVersion value. + */ + public ServerVersion serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: Describes the ServerVersion of an a MongoDB account. + * + * @param serverVersion the serverVersion value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withServerVersion(ServerVersion serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java new file mode 100644 index 0000000000000..e978790d5f66f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ApiType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApiType. */ +public final class ApiType extends ExpandableStringEnum { + /** Static value MongoDB for ApiType. */ + public static final ApiType MONGO_DB = fromString("MongoDB"); + + /** Static value Gremlin for ApiType. */ + public static final ApiType GREMLIN = fromString("Gremlin"); + + /** Static value Cassandra for ApiType. */ + public static final ApiType CASSANDRA = fromString("Cassandra"); + + /** Static value Table for ApiType. */ + public static final ApiType TABLE = fromString("Table"); + + /** Static value Sql for ApiType. */ + public static final ApiType SQL = fromString("Sql"); + + /** Static value GremlinV2 for ApiType. */ + public static final ApiType GREMLIN_V2 = fromString("GremlinV2"); + + /** + * Creates or finds a ApiType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiType. + */ + @JsonCreator + public static ApiType fromString(String name) { + return fromString(name, ApiType.class); + } + + /** @return known ApiType values. */ + public static Collection values() { + return values(ApiType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java new file mode 100644 index 0000000000000..f5ea0550a4a79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmProxyResource.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * The resource model definition for a ARM proxy resource. It will have everything other than required location and + * tags. + */ +@Immutable +public class ArmProxyResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmProxyResource.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java new file mode 100644 index 0000000000000..286611797a11a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ArmResourceProperties.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The core properties of ARM resources. */ +@Fluent +public class ArmResourceProperties extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmResourceProperties.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the ArmResourceProperties object itself. + */ + public ArmResourceProperties withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ArmResourceProperties withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArmResourceProperties withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethod.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethod.java new file mode 100644 index 0000000000000..1c5d35132afaf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AuthenticationMethod.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationMethod. */ +public final class AuthenticationMethod extends ExpandableStringEnum { + /** Static value None for AuthenticationMethod. */ + public static final AuthenticationMethod NONE = fromString("None"); + + /** Static value Cassandra for AuthenticationMethod. */ + public static final AuthenticationMethod CASSANDRA = fromString("Cassandra"); + + /** + * Creates or finds a AuthenticationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationMethod. + */ + @JsonCreator + public static AuthenticationMethod fromString(String name) { + return fromString(name, AuthenticationMethod.class); + } + + /** @return known AuthenticationMethod values. */ + public static Collection values() { + return values(AuthenticationMethod.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java new file mode 100644 index 0000000000000..f1a61ffe3254f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoUpgradePolicyResource.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource auto-upgrade policy. */ +@Fluent +public final class AutoUpgradePolicyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoUpgradePolicyResource.class); + + /* + * Represents throughput policy which service must adhere to for + * auto-upgrade + */ + @JsonProperty(value = "throughputPolicy") + private ThroughputPolicyResource throughputPolicy; + + /** + * Get the throughputPolicy property: Represents throughput policy which service must adhere to for auto-upgrade. + * + * @return the throughputPolicy value. + */ + public ThroughputPolicyResource throughputPolicy() { + return this.throughputPolicy; + } + + /** + * Set the throughputPolicy property: Represents throughput policy which service must adhere to for auto-upgrade. + * + * @param throughputPolicy the throughputPolicy value to set. + * @return the AutoUpgradePolicyResource object itself. + */ + public AutoUpgradePolicyResource withThroughputPolicy(ThroughputPolicyResource throughputPolicy) { + this.throughputPolicy = throughputPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (throughputPolicy() != null) { + throughputPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java new file mode 100644 index 0000000000000..8f41712681bef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AutoscaleSettings model. */ +@Fluent +public final class AutoscaleSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettings.class); + + /* + * Represents maximum throughput, the resource can scale up to. + */ + @JsonProperty(value = "maxThroughput") + private Integer maxThroughput; + + /** + * Get the maxThroughput property: Represents maximum throughput, the resource can scale up to. + * + * @return the maxThroughput value. + */ + public Integer maxThroughput() { + return this.maxThroughput; + } + + /** + * Set the maxThroughput property: Represents maximum throughput, the resource can scale up to. + * + * @param maxThroughput the maxThroughput value to set. + * @return the AutoscaleSettings object itself. + */ + public AutoscaleSettings withMaxThroughput(Integer maxThroughput) { + this.maxThroughput = maxThroughput; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java new file mode 100644 index 0000000000000..2f194bb7eabef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/AutoscaleSettingsResource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB provisioned throughput settings object. */ +@Fluent +public final class AutoscaleSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettingsResource.class); + + /* + * Represents maximum throughput container can scale up to. + */ + @JsonProperty(value = "maxThroughput", required = true) + private int maxThroughput; + + /* + * Cosmos DB resource auto-upgrade policy + */ + @JsonProperty(value = "autoUpgradePolicy") + private AutoUpgradePolicyResource autoUpgradePolicy; + + /* + * Represents target maximum throughput container can scale up to once + * offer is no longer in pending state. + */ + @JsonProperty(value = "targetMaxThroughput", access = JsonProperty.Access.WRITE_ONLY) + private Integer targetMaxThroughput; + + /** + * Get the maxThroughput property: Represents maximum throughput container can scale up to. + * + * @return the maxThroughput value. + */ + public int maxThroughput() { + return this.maxThroughput; + } + + /** + * Set the maxThroughput property: Represents maximum throughput container can scale up to. + * + * @param maxThroughput the maxThroughput value to set. + * @return the AutoscaleSettingsResource object itself. + */ + public AutoscaleSettingsResource withMaxThroughput(int maxThroughput) { + this.maxThroughput = maxThroughput; + return this; + } + + /** + * Get the autoUpgradePolicy property: Cosmos DB resource auto-upgrade policy. + * + * @return the autoUpgradePolicy value. + */ + public AutoUpgradePolicyResource autoUpgradePolicy() { + return this.autoUpgradePolicy; + } + + /** + * Set the autoUpgradePolicy property: Cosmos DB resource auto-upgrade policy. + * + * @param autoUpgradePolicy the autoUpgradePolicy value to set. + * @return the AutoscaleSettingsResource object itself. + */ + public AutoscaleSettingsResource withAutoUpgradePolicy(AutoUpgradePolicyResource autoUpgradePolicy) { + this.autoUpgradePolicy = autoUpgradePolicy; + return this; + } + + /** + * Get the targetMaxThroughput property: Represents target maximum throughput container can scale up to once offer + * is no longer in pending state. + * + * @return the targetMaxThroughput value. + */ + public Integer targetMaxThroughput() { + return this.targetMaxThroughput; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoUpgradePolicy() != null) { + autoUpgradePolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java new file mode 100644 index 0000000000000..3010af64800e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupInformation.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner; + +/** An immutable client-side representation of BackupInformation. */ +public interface BackupInformation { + /** + * Gets the continuousBackupInformation property: Information about the status of continuous backups. + * + * @return the continuousBackupInformation value. + */ + ContinuousBackupInformation continuousBackupInformation(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.BackupInformationInner object. + * + * @return the inner object. + */ + BackupInformationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java new file mode 100644 index 0000000000000..6ac7d0cc18de9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicy.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing the policy for taking backups on an account. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = BackupPolicy.class) +@JsonTypeName("BackupPolicy") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Periodic", value = PeriodicModeBackupPolicy.class), + @JsonSubTypes.Type(name = "Continuous", value = ContinuousModeBackupPolicy.class) +}) +@Fluent +public class BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicy.class); + + /* + * The object representing the state of the migration between the backup + * policies. + */ + @JsonProperty(value = "migrationState") + private BackupPolicyMigrationState migrationState; + + /** + * Get the migrationState property: The object representing the state of the migration between the backup policies. + * + * @return the migrationState value. + */ + public BackupPolicyMigrationState migrationState() { + return this.migrationState; + } + + /** + * Set the migrationState property: The object representing the state of the migration between the backup policies. + * + * @param migrationState the migrationState value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + this.migrationState = migrationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (migrationState() != null) { + migrationState().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java new file mode 100644 index 0000000000000..e28b96790558f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationState.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The object representing the state of the migration between the backup policies. */ +@Fluent +public final class BackupPolicyMigrationState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupPolicyMigrationState.class); + + /* + * Describes the status of migration between backup policy types. + */ + @JsonProperty(value = "status") + private BackupPolicyMigrationStatus status; + + /* + * Describes the target backup policy type of the backup policy migration. + */ + @JsonProperty(value = "targetType") + private BackupPolicyType targetType; + + /* + * Time at which the backup policy migration started (ISO-8601 format). + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /** + * Get the status property: Describes the status of migration between backup policy types. + * + * @return the status value. + */ + public BackupPolicyMigrationStatus status() { + return this.status; + } + + /** + * Set the status property: Describes the status of migration between backup policy types. + * + * @param status the status value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withStatus(BackupPolicyMigrationStatus status) { + this.status = status; + return this; + } + + /** + * Get the targetType property: Describes the target backup policy type of the backup policy migration. + * + * @return the targetType value. + */ + public BackupPolicyType targetType() { + return this.targetType; + } + + /** + * Set the targetType property: Describes the target backup policy type of the backup policy migration. + * + * @param targetType the targetType value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withTargetType(BackupPolicyType targetType) { + this.targetType = targetType; + return this; + } + + /** + * Get the startTime property: Time at which the backup policy migration started (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Time at which the backup policy migration started (ISO-8601 format). + * + * @param startTime the startTime value to set. + * @return the BackupPolicyMigrationState object itself. + */ + public BackupPolicyMigrationState withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java new file mode 100644 index 0000000000000..ffcd6bce6dd3e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyMigrationStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupPolicyMigrationStatus. */ +public final class BackupPolicyMigrationStatus extends ExpandableStringEnum { + /** Static value Invalid for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus INVALID = fromString("Invalid"); + + /** Static value InProgress for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus COMPLETED = fromString("Completed"); + + /** Static value Failed for BackupPolicyMigrationStatus. */ + public static final BackupPolicyMigrationStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a BackupPolicyMigrationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyMigrationStatus. + */ + @JsonCreator + public static BackupPolicyMigrationStatus fromString(String name) { + return fromString(name, BackupPolicyMigrationStatus.class); + } + + /** @return known BackupPolicyMigrationStatus values. */ + public static Collection values() { + return values(BackupPolicyMigrationStatus.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java new file mode 100644 index 0000000000000..2fa04a067d702 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupPolicyType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupPolicyType. */ +public final class BackupPolicyType extends ExpandableStringEnum { + /** Static value Periodic for BackupPolicyType. */ + public static final BackupPolicyType PERIODIC = fromString("Periodic"); + + /** Static value Continuous for BackupPolicyType. */ + public static final BackupPolicyType CONTINUOUS = fromString("Continuous"); + + /** + * Creates or finds a BackupPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupPolicyType. + */ + @JsonCreator + public static BackupPolicyType fromString(String name) { + return fromString(name, BackupPolicyType.class); + } + + /** @return known BackupPolicyType values. */ + public static Collection values() { + return values(BackupPolicyType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResource.java new file mode 100644 index 0000000000000..db9b40edf65b4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResource.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; + +/** An immutable client-side representation of BackupResource. */ +public interface BackupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + BackupResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner object. + * + * @return the inner object. + */ + BackupResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResourceProperties.java new file mode 100644 index 0000000000000..77bfe644806b3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupResourceProperties.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The BackupResourceProperties model. */ +@Fluent +public final class BackupResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupResourceProperties.class); + + /* + * The time this backup was taken, formatted like 2021-01-21T17:35:21 + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /** + * Get the timestamp property: The time this backup was taken, formatted like 2021-01-21T17:35:21. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The time this backup was taken, formatted like 2021-01-21T17:35:21. + * + * @param timestamp the timestamp value to set. + * @return the BackupResourceProperties object itself. + */ + public BackupResourceProperties withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupStorageRedundancy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupStorageRedundancy.java new file mode 100644 index 0000000000000..4a284b494f25e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/BackupStorageRedundancy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupStorageRedundancy. */ +public final class BackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy ZONE = fromString("Zone"); + + /** + * Creates or finds a BackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupStorageRedundancy. + */ + @JsonCreator + public static BackupStorageRedundancy fromString(String name) { + return fromString(name, BackupStorageRedundancy.class); + } + + /** @return known BackupStorageRedundancy values. */ + public static Collection values() { + return values(BackupStorageRedundancy.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java new file mode 100644 index 0000000000000..325a570bb807d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Capability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB capability object. */ +@Fluent +public final class Capability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Capability.class); + + /* + * Name of the Cosmos DB capability. For example, "name": + * "EnableCassandra". Current values also include "EnableTable" and + * "EnableGremlin". + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values + * also include "EnableTable" and "EnableGremlin". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values + * also include "EnableTable" and "EnableGremlin". + * + * @param name the name value to set. + * @return the Capability object itself. + */ + public Capability withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusters.java new file mode 100644 index 0000000000000..d9cc8ea433e07 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraClusters.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CassandraClusters. */ +public interface CassandraClusters { + /** + * List all managed Cassandra clusters in this subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + PagedIterable list(); + + /** + * List all managed Cassandra clusters in this subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + PagedIterable list(Context context); + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all managed Cassandra clusters in this resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra clusters. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + ClusterResource getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Deletes a managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterName, Context context); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void requestRepair(String resourceGroupName, String clusterName, RepairPostBody body, Context context); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + ClusterNodeStatus fetchNodeStatus(String resourceGroupName, String clusterName); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + ClusterNodeStatus fetchNodeStatus(String resourceGroupName, String clusterName, Context context); + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + PagedIterable listBackups(String resourceGroupName, String clusterName); + + /** + * List the backups of this cluster that are available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of restorable backups for a Cassandra cluster. + */ + PagedIterable listBackups(String resourceGroupName, String clusterName, Context context); + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + BackupResource getBackup(String resourceGroupName, String clusterName, String backupId); + + /** + * Get the properties of an individual backup of this cluster that is available to restore. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param backupId Id of a restorable backup of a Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an individual backup of this cluster that is available to restore. + */ + Response getBackupWithResponse( + String resourceGroupName, String clusterName, String backupId, Context context); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + ClusterResource getById(String id); + + /** + * Get the properties of a managed Cassandra cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra cluster. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed Cassandra cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a managed Cassandra cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ClusterResource resource. + * + * @param name resource name. + * @return the first stage of the new ClusterResource definition. + */ + ClusterResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraDataCenters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraDataCenters.java new file mode 100644 index 0000000000000..bb1a8486dd591 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraDataCenters.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CassandraDataCenters. */ +public interface CassandraDataCenters { + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + PagedIterable list(String resourceGroupName, String clusterName); + + /** + * List all data centers in a particular managed Cassandra cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed Cassandra data centers and their properties. + */ + PagedIterable list(String resourceGroupName, String clusterName, Context context); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + DataCenterResource get(String resourceGroupName, String clusterName, String dataCenterName); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + Response getWithResponse( + String resourceGroupName, String clusterName, String dataCenterName, Context context); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterName, String dataCenterName); + + /** + * Delete a managed Cassandra data center. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @param dataCenterName Data center name in a managed Cassandra cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterName, String dataCenterName, Context context); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + DataCenterResource getById(String id); + + /** + * Get the properties of a managed Cassandra data center. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a managed Cassandra data center. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a managed Cassandra data center. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a managed Cassandra data center. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataCenterResource resource. + * + * @param name resource name. + * @return the first stage of the new DataCenterResource definition. + */ + DataCenterResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java new file mode 100644 index 0000000000000..9dd97efc6dea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Cassandra keyspace. */ +@Fluent +public final class CassandraKeyspaceCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Cassandra keyspace. + */ + @JsonProperty(value = "properties", required = true) + private CassandraKeyspaceCreateUpdateProperties innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Cassandra keyspace. + * + * @return the innerProperties value. + */ + private CassandraKeyspaceCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Cassandra keyspace. + * + * @return the resource value. + */ + public CassandraKeyspaceResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource the resource value to set. + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withResource(CassandraKeyspaceResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraKeyspaceCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model CassandraKeyspaceCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java new file mode 100644 index 0000000000000..1d027577cca49 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraKeyspaceGetPropertiesOptions model. */ +@Fluent +public final class CassandraKeyspaceGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java new file mode 100644 index 0000000000000..56411b8277674 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraKeyspaceGetPropertiesResource model. */ +@Fluent +public final class CassandraKeyspaceGetPropertiesResource extends CassandraKeyspaceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public CassandraKeyspaceGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java new file mode 100644 index 0000000000000..6ab54d91d33cd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of CassandraKeyspaceGetResults. */ +public interface CassandraKeyspaceGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + CassandraKeyspaceGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + CassandraKeyspaceGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner object. + * + * @return the inner object. + */ + CassandraKeyspaceGetResultsInner innerModel(); + + /** The entirety of the CassandraKeyspaceGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The CassandraKeyspaceGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the CassandraKeyspaceGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource The standard JSON format of a Cassandra keyspace. + * @return the next definition stage. + */ + WithCreate withResource(CassandraKeyspaceResource resource); + } + /** + * The stage of the CassandraKeyspaceGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + CassandraKeyspaceGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CassandraKeyspaceGetResults create(Context context); + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraKeyspaceGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the CassandraKeyspaceGetResults resource. + * + * @return the stage of resource update. + */ + CassandraKeyspaceGetResults.Update update(); + + /** The template for CassandraKeyspaceGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CassandraKeyspaceGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CassandraKeyspaceGetResults apply(Context context); + } + /** The CassandraKeyspaceGetResults update stages. */ + interface UpdateStages { + /** The stage of the CassandraKeyspaceGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the CassandraKeyspaceGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraKeyspaceGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra keyspace. + * + * @param resource The standard JSON format of a Cassandra keyspace. + * @return the next definition stage. + */ + Update withResource(CassandraKeyspaceResource resource); + } + /** The stage of the CassandraKeyspaceGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CassandraKeyspaceGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CassandraKeyspaceGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.java new file mode 100644 index 0000000000000..6aad7ec7131d9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraKeyspaceGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra keyspaces and their properties. */ +@Immutable +public final class CassandraKeyspaceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceListResult.class); + + /* + * List of Cassandra keyspaces and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cassandra keyspaces and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java new file mode 100644 index 0000000000000..7365b796dcdbb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraKeyspaceResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra keyspace resource object. */ +@Fluent +public class CassandraKeyspaceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraKeyspaceResource.class); + + /* + * Name of the Cosmos DB Cassandra keyspace + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB Cassandra keyspace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Cassandra keyspace. + * + * @param id the id value to set. + * @return the CassandraKeyspaceResource object itself. + */ + public CassandraKeyspaceResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraKeyspaceResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java new file mode 100644 index 0000000000000..608cf94fbf3db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraPartitionKey.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table partition key. */ +@Fluent +public final class CassandraPartitionKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraPartitionKey.class); + + /* + * Name of the Cosmos DB Cassandra table partition key + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table partition key. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table partition key. + * + * @param name the name value to set. + * @return the CassandraPartitionKey object itself. + */ + public CassandraPartitionKey withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java new file mode 100644 index 0000000000000..3fa18fc76843c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraResources.java @@ -0,0 +1,834 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CassandraResources. */ +public interface CassandraResources { + /** + * Lists the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + PagedIterable listCassandraKeyspaces(String resourceGroupName, String accountName); + + /** + * Lists the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra keyspaces and their properties. + */ + PagedIterable listCassandraKeyspaces( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Cassandra keyspaces 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + CassandraKeyspaceGetResults getCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the Cassandra keyspaces 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + Response getCassandraKeyspaceWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the RUs per second of the Cassandra Keyspace 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getCassandraKeyspaceThroughput( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the RUs per second of the Cassandra Keyspace 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getCassandraKeyspaceThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra + * Keyspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraKeyspaceThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraKeyspaceToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra tables and their properties. + */ + PagedIterable listCassandraTables( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + CassandraTableGetResults getCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + Response getCassandraTableWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTable( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getCassandraTableThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getCassandraTableThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraTableThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraTableToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String tableName, Context context); + + /** + * Lists the Cassandra materialized views 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName); + + /** + * Lists the Cassandra materialized views 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Cassandra views and their properties. + */ + PagedIterable listCassandraViews( + String resourceGroupName, String accountName, String keyspaceName, Context context); + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + CassandraViewGetResults getCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Gets the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + Response getCassandraViewWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraView(String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraView( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getCassandraViewThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Gets the RUs per second of the Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getCassandraViewThroughputWithResponse( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra view. + * + * @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 viewName Cosmos DB view name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra view. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateCassandraViewThroughput( + String resourceGroupName, + String accountName, + String keyspaceName, + String viewName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraViewToAutoscale( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName); + + /** + * Migrate an Azure Cosmos DB Cassandra view 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 viewName Cosmos DB view name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateCassandraViewToManualThroughput( + String resourceGroupName, String accountName, String keyspaceName, String viewName, Context context); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + CassandraKeyspaceGetResults getCassandraKeyspaceById(String id); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + */ + Response getCassandraKeyspaceByIdWithResponse(String id, Context context); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + CassandraTableGetResults getCassandraTableById(String id); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra table under an existing Azure Cosmos DB database account. + */ + Response getCassandraTableByIdWithResponse(String id, Context context); + + /** + * Gets the Cassandra view under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + CassandraViewGetResults getCassandraViewById(String id); + + /** + * Gets the Cassandra view under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Cassandra view under an existing Azure Cosmos DB database account. + */ + Response getCassandraViewByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspaceById(String id); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraKeyspaceByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTableById(String id); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraTableByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraViewById(String id); + + /** + * Deletes an existing Azure Cosmos DB Cassandra view. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteCassandraViewByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CassandraKeyspaceGetResults resource. + * + * @param name resource name. + * @return the first stage of the new CassandraKeyspaceGetResults definition. + */ + CassandraKeyspaceGetResults.DefinitionStages.Blank defineUpdateCassandraKeyspace(String name); + + /** + * Begins definition for a new CassandraTableGetResults resource. + * + * @param name resource name. + * @return the first stage of the new CassandraTableGetResults definition. + */ + CassandraTableGetResults.DefinitionStages.Blank defineUpdateCassandraTable(String name); + + /** + * Begins definition for a new CassandraViewGetResults resource. + * + * @param name resource name. + * @return the first stage of the new CassandraViewGetResults definition. + */ + CassandraViewGetResults.DefinitionStages.Blank defineUpdateCassandraView(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java new file mode 100644 index 0000000000000..3e144a9cf971e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraSchema.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB Cassandra table schema. */ +@Fluent +public final class CassandraSchema { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraSchema.class); + + /* + * List of Cassandra table columns. + */ + @JsonProperty(value = "columns") + private List columns; + + /* + * List of partition key. + */ + @JsonProperty(value = "partitionKeys") + private List partitionKeys; + + /* + * List of cluster key. + */ + @JsonProperty(value = "clusterKeys") + private List clusterKeys; + + /** + * Get the columns property: List of Cassandra table columns. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: List of Cassandra table columns. + * + * @param columns the columns value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the partitionKeys property: List of partition key. + * + * @return the partitionKeys value. + */ + public List partitionKeys() { + return this.partitionKeys; + } + + /** + * Set the partitionKeys property: List of partition key. + * + * @param partitionKeys the partitionKeys value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withPartitionKeys(List partitionKeys) { + this.partitionKeys = partitionKeys; + return this; + } + + /** + * Get the clusterKeys property: List of cluster key. + * + * @return the clusterKeys value. + */ + public List clusterKeys() { + return this.clusterKeys; + } + + /** + * Set the clusterKeys property: List of cluster key. + * + * @param clusterKeys the clusterKeys value to set. + * @return the CassandraSchema object itself. + */ + public CassandraSchema withClusterKeys(List clusterKeys) { + this.clusterKeys = clusterKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + if (partitionKeys() != null) { + partitionKeys().forEach(e -> e.validate()); + } + if (clusterKeys() != null) { + clusterKeys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java new file mode 100644 index 0000000000000..f946e87120d17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Cassandra table. */ +@Fluent +public final class CassandraTableCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Cassandra table. + */ + @JsonProperty(value = "properties", required = true) + private CassandraTableCreateUpdateProperties innerProperties = new CassandraTableCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Cassandra table. + * + * @return the innerProperties value. + */ + private CassandraTableCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Cassandra table. + * + * @return the resource value. + */ + public CassandraTableResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Cassandra table. + * + * @param resource the resource value to set. + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withResource(CassandraTableResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraTableCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model CassandraTableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java new file mode 100644 index 0000000000000..2f025d8feaf15 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraTableGetPropertiesOptions model. */ +@Fluent +public final class CassandraTableGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java new file mode 100644 index 0000000000000..e5e3ceaccf838 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetPropertiesResource.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraTableGetPropertiesResource model. */ +@Fluent +public final class CassandraTableGetPropertiesResource extends CassandraTableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withSchema(CassandraSchema schema) { + super.withSchema(schema); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraTableGetPropertiesResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java new file mode 100644 index 0000000000000..970e968b14912 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableGetResults.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of CassandraTableGetResults. */ +public interface CassandraTableGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + CassandraTableGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + CassandraTableGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner object. + * + * @return the inner object. + */ + CassandraTableGetResultsInner innerModel(); + + /** The entirety of the CassandraTableGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The CassandraTableGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the CassandraTableGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CassandraTableGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the CassandraTableGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, keyspaceName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + } + /** The stage of the CassandraTableGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra table. + * + * @param resource The standard JSON format of a Cassandra table. + * @return the next definition stage. + */ + WithCreate withResource(CassandraTableResource resource); + } + /** + * The stage of the CassandraTableGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + CassandraTableGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CassandraTableGetResults create(Context context); + } + /** The stage of the CassandraTableGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CassandraTableGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraTableGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the CassandraTableGetResults resource. + * + * @return the stage of resource update. + */ + CassandraTableGetResults.Update update(); + + /** The template for CassandraTableGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CassandraTableGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CassandraTableGetResults apply(Context context); + } + /** The CassandraTableGetResults update stages. */ + interface UpdateStages { + /** The stage of the CassandraTableGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the CassandraTableGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraTableGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra table. + * + * @param resource The standard JSON format of a Cassandra table. + * @return the next definition stage. + */ + Update withResource(CassandraTableResource resource); + } + /** The stage of the CassandraTableGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CassandraTableGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CassandraTableGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.java new file mode 100644 index 0000000000000..e8a511198fc08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraTableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra tables and their properties. */ +@Immutable +public final class CassandraTableListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableListResult.class); + + /* + * List of Cassandra tables and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cassandra tables and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java new file mode 100644 index 0000000000000..0343c80906184 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraTableResource.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table resource object. */ +@Fluent +public class CassandraTableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraTableResource.class); + + /* + * Name of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Time to live of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * Schema of the Cosmos DB Cassandra table + */ + @JsonProperty(value = "schema") + private CassandraSchema schema; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB Cassandra table. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Cassandra table. + * + * @param id the id value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the defaultTtl property: Time to live of the Cosmos DB Cassandra table. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Time to live of the Cosmos DB Cassandra table. + * + * @param defaultTtl the defaultTtl value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the schema property: Schema of the Cosmos DB Cassandra table. + * + * @return the schema value. + */ + public CassandraSchema schema() { + return this.schema; + } + + /** + * Set the schema property: Schema of the Cosmos DB Cassandra table. + * + * @param schema the schema value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withSchema(CassandraSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Integer analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraTableResource")); + } + if (schema() != null) { + schema().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewCreateUpdateParameters.java new file mode 100644 index 0000000000000..217805afb0e43 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Cassandra view. */ +@Fluent +public final class CassandraViewCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Cassandra view. + */ + @JsonProperty(value = "properties", required = true) + private CassandraViewCreateUpdateProperties innerProperties = new CassandraViewCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Cassandra view. + * + * @return the innerProperties value. + */ + private CassandraViewCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Cassandra view. + * + * @return the resource value. + */ + public CassandraViewResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Cassandra view. + * + * @param resource the resource value to set. + * @return the CassandraViewCreateUpdateParameters object itself. + */ + public CassandraViewCreateUpdateParameters withResource(CassandraViewResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraViewCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the CassandraViewCreateUpdateParameters object itself. + */ + public CassandraViewCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new CassandraViewCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model CassandraViewCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesOptions.java new file mode 100644 index 0000000000000..994eb2935cf47 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The CassandraViewGetPropertiesOptions model. */ +@Fluent +public final class CassandraViewGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public CassandraViewGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesResource.java new file mode 100644 index 0000000000000..1a4f3cfac50c8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CassandraViewGetPropertiesResource model. */ +@Fluent +public final class CassandraViewGetPropertiesResource extends CassandraViewResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public CassandraViewGetPropertiesResource withViewDefinition(String viewDefinition) { + super.withViewDefinition(viewDefinition); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetResults.java new file mode 100644 index 0000000000000..93efd864be73e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewGetResults.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of CassandraViewGetResults. */ +public interface CassandraViewGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + CassandraViewGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + CassandraViewGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner object. + * + * @return the inner object. + */ + CassandraViewGetResultsInner innerModel(); + + /** The entirety of the CassandraViewGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The CassandraViewGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the CassandraViewGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CassandraViewGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the CassandraViewGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, keyspaceName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingCassandraKeyspace( + String resourceGroupName, String accountName, String keyspaceName); + } + /** The stage of the CassandraViewGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra view. + * + * @param resource The standard JSON format of a Cassandra view. + * @return the next definition stage. + */ + WithCreate withResource(CassandraViewResource resource); + } + /** + * The stage of the CassandraViewGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + CassandraViewGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CassandraViewGetResults create(Context context); + } + /** The stage of the CassandraViewGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CassandraViewGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraViewGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the CassandraViewGetResults resource. + * + * @return the stage of resource update. + */ + CassandraViewGetResults.Update update(); + + /** The template for CassandraViewGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CassandraViewGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CassandraViewGetResults apply(Context context); + } + /** The CassandraViewGetResults update stages. */ + interface UpdateStages { + /** The stage of the CassandraViewGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the CassandraViewGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CassandraViewGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Cassandra view. + * + * @param resource The standard JSON format of a Cassandra view. + * @return the next definition stage. + */ + Update withResource(CassandraViewResource resource); + } + /** The stage of the CassandraViewGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CassandraViewGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CassandraViewGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewListResult.java new file mode 100644 index 0000000000000..d664c3e8d0e90 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.CassandraViewGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Cassandra views and their properties. */ +@Immutable +public final class CassandraViewListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewListResult.class); + + /* + * List of Cassandra views and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cassandra views and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewResource.java new file mode 100644 index 0000000000000..9ed323c5a3947 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CassandraViewResource.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra view resource object. */ +@Fluent +public class CassandraViewResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CassandraViewResource.class); + + /* + * Name of the Cosmos DB Cassandra view + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * View Definition of the Cosmos DB Cassandra view + */ + @JsonProperty(value = "viewDefinition", required = true) + private String viewDefinition; + + /** + * Get the id property: Name of the Cosmos DB Cassandra view. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Cassandra view. + * + * @param id the id value to set. + * @return the CassandraViewResource object itself. + */ + public CassandraViewResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the viewDefinition property: View Definition of the Cosmos DB Cassandra view. + * + * @return the viewDefinition value. + */ + public String viewDefinition() { + return this.viewDefinition; + } + + /** + * Set the viewDefinition property: View Definition of the Cosmos DB Cassandra view. + * + * @param viewDefinition the viewDefinition value to set. + * @return the CassandraViewResource object itself. + */ + public CassandraViewResource withViewDefinition(String viewDefinition) { + this.viewDefinition = viewDefinition; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CassandraViewResource")); + } + if (viewDefinition() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property viewDefinition in model CassandraViewResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Certificate.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Certificate.java new file mode 100644 index 0000000000000..081a77b961925 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Certificate.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Certificate model. */ +@Fluent +public final class Certificate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Certificate.class); + + /* + * PEM formatted public key. + */ + @JsonProperty(value = "pem") + private String pem; + + /** + * Get the pem property: PEM formatted public key. + * + * @return the pem value. + */ + public String pem() { + return this.pem; + } + + /** + * Set the pem property: PEM formatted public key. + * + * @param pem the pem value to set. + * @return the Certificate object itself. + */ + public Certificate withPem(String pem) { + this.pem = pem; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java new file mode 100644 index 0000000000000..f1af8e047a2ae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterKey.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table cluster key. */ +@Fluent +public final class ClusterKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterKey.class); + + /* + * Name of the Cosmos DB Cassandra table cluster key + */ + @JsonProperty(value = "name") + private String name; + + /* + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" + * and "Desc" + */ + @JsonProperty(value = "orderBy") + private String orderBy; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table cluster key. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table cluster key. + * + * @param name the name value to set. + * @return the ClusterKey object itself. + */ + public ClusterKey withName(String name) { + this.name = name; + return this; + } + + /** + * Get the orderBy property: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @return the orderBy value. + */ + public String orderBy() { + return this.orderBy; + } + + /** + * Set the orderBy property: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @param orderBy the orderBy value to set. + * @return the ClusterKey object itself. + */ + public ClusterKey withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatus.java new file mode 100644 index 0000000000000..d4f0bee588b34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatus.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner; +import java.util.List; + +/** An immutable client-side representation of ClusterNodeStatus. */ +public interface ClusterNodeStatus { + /** + * Gets the nodes property: Information about nodes in the cluster (corresponds to what is returned from nodetool + * info). + * + * @return the nodes value. + */ + List nodes(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterNodeStatusInner object. + * + * @return the inner object. + */ + ClusterNodeStatusInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatusNodesItem.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatusNodesItem.java new file mode 100644 index 0000000000000..062bfc24ed770 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterNodeStatusNodesItem.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ClusterNodeStatusNodesItem model. */ +@Fluent +public final class ClusterNodeStatusNodesItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterNodeStatusNodesItem.class); + + /* + * The Cassandra data center this node resides in. + */ + @JsonProperty(value = "datacenter") + private String datacenter; + + /* + * Indicates whether the node is functioning or not. + */ + @JsonProperty(value = "status") + private NodeStatus status; + + /* + * The state of the node in relation to the cluster. + */ + @JsonProperty(value = "state") + private NodeState state; + + /* + * The node's URL. + */ + @JsonProperty(value = "address") + private String address; + + /* + * The amount of file system data in the data directory (e.g., 47.66 KB), + * excluding all content in the snapshots subdirectories. Because all + * SSTable data files are included, any data that is not cleaned up (such + * as TTL-expired cell or tombstoned data) is counted. + */ + @JsonProperty(value = "load") + private String load; + + /* + * List of tokens. + */ + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The percentage of the data owned by the node per datacenter times the + * replication factor (e.g., 33.3, or null if the data is not available). + * For example, a node can own 33% of the ring, but shows 100% if the + * replication factor is 3. For non-system keyspaces, the endpoint + * percentage ownership information is shown. + */ + @JsonProperty(value = "owns") + private Double owns; + + /* + * The network ID of the node. + */ + @JsonProperty(value = "hostId") + private String hostId; + + /* + * The rack this node is part of. + */ + @JsonProperty(value = "rack") + private String rack; + + /** + * Get the datacenter property: The Cassandra data center this node resides in. + * + * @return the datacenter value. + */ + public String datacenter() { + return this.datacenter; + } + + /** + * Set the datacenter property: The Cassandra data center this node resides in. + * + * @param datacenter the datacenter value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withDatacenter(String datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * Get the status property: Indicates whether the node is functioning or not. + * + * @return the status value. + */ + public NodeStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the node is functioning or not. + * + * @param status the status value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withStatus(NodeStatus status) { + this.status = status; + return this; + } + + /** + * Get the state property: The state of the node in relation to the cluster. + * + * @return the state value. + */ + public NodeState state() { + return this.state; + } + + /** + * Set the state property: The state of the node in relation to the cluster. + * + * @param state the state value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withState(NodeState state) { + this.state = state; + return this; + } + + /** + * Get the address property: The node's URL. + * + * @return the address value. + */ + public String address() { + return this.address; + } + + /** + * Set the address property: The node's URL. + * + * @param address the address value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withAddress(String address) { + this.address = address; + return this; + } + + /** + * Get the load property: The amount of file system data in the data directory (e.g., 47.66 KB), excluding all + * content in the snapshots subdirectories. Because all SSTable data files are included, any data that is not + * cleaned up (such as TTL-expired cell or tombstoned data) is counted. + * + * @return the load value. + */ + public String load() { + return this.load; + } + + /** + * Set the load property: The amount of file system data in the data directory (e.g., 47.66 KB), excluding all + * content in the snapshots subdirectories. Because all SSTable data files are included, any data that is not + * cleaned up (such as TTL-expired cell or tombstoned data) is counted. + * + * @param load the load value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withLoad(String load) { + this.load = load; + return this; + } + + /** + * Get the tokens property: List of tokens. + * + * @return the tokens value. + */ + public List tokens() { + return this.tokens; + } + + /** + * Set the tokens property: List of tokens. + * + * @param tokens the tokens value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withTokens(List tokens) { + this.tokens = tokens; + return this; + } + + /** + * Get the owns property: The percentage of the data owned by the node per datacenter times the replication factor + * (e.g., 33.3, or null if the data is not available). For example, a node can own 33% of the ring, but shows 100% + * if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. + * + * @return the owns value. + */ + public Double owns() { + return this.owns; + } + + /** + * Set the owns property: The percentage of the data owned by the node per datacenter times the replication factor + * (e.g., 33.3, or null if the data is not available). For example, a node can own 33% of the ring, but shows 100% + * if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. + * + * @param owns the owns value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withOwns(Double owns) { + this.owns = owns; + return this; + } + + /** + * Get the hostId property: The network ID of the node. + * + * @return the hostId value. + */ + public String hostId() { + return this.hostId; + } + + /** + * Set the hostId property: The network ID of the node. + * + * @param hostId the hostId value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withHostId(String hostId) { + this.hostId = hostId; + return this; + } + + /** + * Get the rack property: The rack this node is part of. + * + * @return the rack value. + */ + public String rack() { + return this.rack; + } + + /** + * Set the rack property: The rack this node is part of. + * + * @param rack the rack value to set. + * @return the ClusterNodeStatusNodesItem object itself. + */ + public ClusterNodeStatusNodesItem withRack(String rack) { + this.rack = rack; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResource.java new file mode 100644 index 0000000000000..934ac568b5347 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResource.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ClusterResource. */ +public interface ClusterResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the properties property: Properties of a managed Cassandra cluster. + * + * @return the properties value. + */ + ClusterResourceProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner object. + * + * @return the inner object. + */ + ClusterResourceInner innerModel(); + + /** The entirety of the ClusterResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ClusterResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ClusterResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ClusterResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ClusterResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ClusterResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ClusterResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ClusterResource create(Context context); + } + /** The stage of the ClusterResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ClusterResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the ClusterResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of a managed Cassandra cluster.. + * + * @param properties Properties of a managed Cassandra cluster. + * @return the next definition stage. + */ + WithCreate withProperties(ClusterResourceProperties properties); + } + } + /** + * Begins update for the ClusterResource resource. + * + * @return the stage of resource update. + */ + ClusterResource.Update update(); + + /** The template for ClusterResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ClusterResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ClusterResource apply(Context context); + } + /** The ClusterResource update stages. */ + interface UpdateStages { + /** The stage of the ClusterResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ClusterResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the ClusterResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of a managed Cassandra cluster.. + * + * @param properties Properties of a managed Cassandra cluster. + * @return the next definition stage. + */ + Update withProperties(ClusterResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ClusterResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ClusterResource refresh(Context context); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param body Specification of what keyspaces and tables to run repair on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void requestRepair(RepairPostBody body); + + /** + * Request that repair begin on this cluster as soon as possible. + * + * @param body Specification of what keyspaces and tables to run repair on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void requestRepair(RepairPostBody body, Context context); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + ClusterNodeStatus fetchNodeStatus(); + + /** + * Request the status of all nodes in the cluster (as returned by 'nodetool status'). + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of all nodes in the cluster (as returned by 'nodetool status'). + */ + ClusterNodeStatus fetchNodeStatus(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResourceProperties.java new file mode 100644 index 0000000000000..db69626445879 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ClusterResourceProperties.java @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a managed Cassandra cluster. */ +@Fluent +public final class ClusterResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterResourceProperties.class); + + /* + * The status of the resource at the time the operation was called. + */ + @JsonProperty(value = "provisioningState") + private ManagedCassandraProvisioningState provisioningState; + + /* + * To create an empty cluster, omit this field or set it to null. To + * restore a backup into a new cluster, set this field to the resource id + * of the backup. + */ + @JsonProperty(value = "restoreFromBackupId") + private String restoreFromBackupId; + + /* + * Resource id of a subnet that this cluster's management service should + * have its network interface attached to. The subnet must be routable to + * all subnets that will be delegated to data centers. The resource id must + * be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/' + */ + @JsonProperty(value = "delegatedManagementSubnetId") + private String delegatedManagementSubnetId; + + /* + * Which version of Cassandra should this cluster converge to running + * (e.g., 3.11). When updated, the cluster may take some time to migrate to + * the new version. + */ + @JsonProperty(value = "cassandraVersion") + private String cassandraVersion; + + /* + * If you need to set the clusterName property in cassandra.yaml to + * something besides the resource name of the cluster, set the value to use + * on this property. + */ + @JsonProperty(value = "clusterNameOverride") + private String clusterNameOverride; + + /* + * Which authentication method Cassandra should use to authenticate + * clients. 'None' turns off authentication, so should not be used except + * in emergencies. 'Cassandra' is the default password based + * authentication. The default is 'Cassandra'. + */ + @JsonProperty(value = "authenticationMethod") + private AuthenticationMethod authenticationMethod; + + /* + * Initial password for clients connecting as admin to the cluster. Should + * be changed after cluster creation. Returns null on GET. This field only + * applies when the authenticationMethod field is 'Cassandra'. + */ + @JsonProperty(value = "initialCassandraAdminPassword") + private String initialCassandraAdminPassword; + + /* + * Number of hours to wait between taking a backup of the cluster. To + * disable backups, set this property to 0. + */ + @JsonProperty(value = "hoursBetweenBackups") + private Integer hoursBetweenBackups; + + /* + * Hostname or IP address where the Prometheus endpoint containing data + * about the managed Cassandra nodes can be reached. + */ + @JsonProperty(value = "prometheusEndpoint") + private SeedNode prometheusEndpoint; + + /* + * Should automatic repairs run on this cluster? If omitted, this is true, + * and should stay true unless you are running a hybrid cluster where you + * are already doing your own repairs. + */ + @JsonProperty(value = "repairEnabled") + private Boolean repairEnabled; + + /* + * List of TLS certificates used to authorize clients connecting to the + * cluster. All connections are TLS encrypted whether clientCertificates is + * set or not, but if clientCertificates is set, the managed Cassandra + * cluster will reject all connections not bearing a TLS client certificate + * that can be validated from one or more of the public certificates in + * this property. + */ + @JsonProperty(value = "clientCertificates") + private List clientCertificates; + + /* + * List of TLS certificates used to authorize gossip from unmanaged data + * centers. The TLS certificates of all nodes in unmanaged data centers + * must be verifiable using one of the certificates provided in this + * property. + */ + @JsonProperty(value = "externalGossipCertificates") + private List externalGossipCertificates; + + /* + * List of TLS certificates that unmanaged nodes must trust for gossip with + * managed nodes. All managed nodes will present TLS client certificates + * that are verifiable using one of the certificates provided in this + * property. + */ + @JsonProperty(value = "gossipCertificates", access = JsonProperty.Access.WRITE_ONLY) + private List gossipCertificates; + + /* + * List of IP addresses of seed nodes in unmanaged data centers. These will + * be added to the seed node lists of all managed nodes. + */ + @JsonProperty(value = "externalSeedNodes") + private List externalSeedNodes; + + /* + * List of IP addresses of seed nodes in the managed data centers. These + * should be added to the seed node lists of all unmanaged nodes. + */ + @JsonProperty(value = "seedNodes", access = JsonProperty.Access.WRITE_ONLY) + private List seedNodes; + + /** + * Get the provisioningState property: The status of the resource at the time the operation was called. + * + * @return the provisioningState value. + */ + public ManagedCassandraProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The status of the resource at the time the operation was called. + * + * @param provisioningState the provisioningState value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withProvisioningState(ManagedCassandraProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the restoreFromBackupId property: To create an empty cluster, omit this field or set it to null. To restore a + * backup into a new cluster, set this field to the resource id of the backup. + * + * @return the restoreFromBackupId value. + */ + public String restoreFromBackupId() { + return this.restoreFromBackupId; + } + + /** + * Set the restoreFromBackupId property: To create an empty cluster, omit this field or set it to null. To restore a + * backup into a new cluster, set this field to the resource id of the backup. + * + * @param restoreFromBackupId the restoreFromBackupId value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withRestoreFromBackupId(String restoreFromBackupId) { + this.restoreFromBackupId = restoreFromBackupId; + return this; + } + + /** + * Get the delegatedManagementSubnetId property: Resource id of a subnet that this cluster's management service + * should have its network interface attached to. The subnet must be routable to all subnets that will be delegated + * to data centers. The resource id must be of the form '/subscriptions/<subscription + * id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual + * network>/subnets/<subnet>'. + * + * @return the delegatedManagementSubnetId value. + */ + public String delegatedManagementSubnetId() { + return this.delegatedManagementSubnetId; + } + + /** + * Set the delegatedManagementSubnetId property: Resource id of a subnet that this cluster's management service + * should have its network interface attached to. The subnet must be routable to all subnets that will be delegated + * to data centers. The resource id must be of the form '/subscriptions/<subscription + * id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual + * network>/subnets/<subnet>'. + * + * @param delegatedManagementSubnetId the delegatedManagementSubnetId value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withDelegatedManagementSubnetId(String delegatedManagementSubnetId) { + this.delegatedManagementSubnetId = delegatedManagementSubnetId; + return this; + } + + /** + * Get the cassandraVersion property: Which version of Cassandra should this cluster converge to running (e.g., + * 3.11). When updated, the cluster may take some time to migrate to the new version. + * + * @return the cassandraVersion value. + */ + public String cassandraVersion() { + return this.cassandraVersion; + } + + /** + * Set the cassandraVersion property: Which version of Cassandra should this cluster converge to running (e.g., + * 3.11). When updated, the cluster may take some time to migrate to the new version. + * + * @param cassandraVersion the cassandraVersion value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withCassandraVersion(String cassandraVersion) { + this.cassandraVersion = cassandraVersion; + return this; + } + + /** + * Get the clusterNameOverride property: If you need to set the clusterName property in cassandra.yaml to something + * besides the resource name of the cluster, set the value to use on this property. + * + * @return the clusterNameOverride value. + */ + public String clusterNameOverride() { + return this.clusterNameOverride; + } + + /** + * Set the clusterNameOverride property: If you need to set the clusterName property in cassandra.yaml to something + * besides the resource name of the cluster, set the value to use on this property. + * + * @param clusterNameOverride the clusterNameOverride value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withClusterNameOverride(String clusterNameOverride) { + this.clusterNameOverride = clusterNameOverride; + return this; + } + + /** + * Get the authenticationMethod property: Which authentication method Cassandra should use to authenticate clients. + * 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password + * based authentication. The default is 'Cassandra'. + * + * @return the authenticationMethod value. + */ + public AuthenticationMethod authenticationMethod() { + return this.authenticationMethod; + } + + /** + * Set the authenticationMethod property: Which authentication method Cassandra should use to authenticate clients. + * 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password + * based authentication. The default is 'Cassandra'. + * + * @param authenticationMethod the authenticationMethod value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withAuthenticationMethod(AuthenticationMethod authenticationMethod) { + this.authenticationMethod = authenticationMethod; + return this; + } + + /** + * Get the initialCassandraAdminPassword property: Initial password for clients connecting as admin to the cluster. + * Should be changed after cluster creation. Returns null on GET. This field only applies when the + * authenticationMethod field is 'Cassandra'. + * + * @return the initialCassandraAdminPassword value. + */ + public String initialCassandraAdminPassword() { + return this.initialCassandraAdminPassword; + } + + /** + * Set the initialCassandraAdminPassword property: Initial password for clients connecting as admin to the cluster. + * Should be changed after cluster creation. Returns null on GET. This field only applies when the + * authenticationMethod field is 'Cassandra'. + * + * @param initialCassandraAdminPassword the initialCassandraAdminPassword value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withInitialCassandraAdminPassword(String initialCassandraAdminPassword) { + this.initialCassandraAdminPassword = initialCassandraAdminPassword; + return this; + } + + /** + * Get the hoursBetweenBackups property: Number of hours to wait between taking a backup of the cluster. To disable + * backups, set this property to 0. + * + * @return the hoursBetweenBackups value. + */ + public Integer hoursBetweenBackups() { + return this.hoursBetweenBackups; + } + + /** + * Set the hoursBetweenBackups property: Number of hours to wait between taking a backup of the cluster. To disable + * backups, set this property to 0. + * + * @param hoursBetweenBackups the hoursBetweenBackups value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withHoursBetweenBackups(Integer hoursBetweenBackups) { + this.hoursBetweenBackups = hoursBetweenBackups; + return this; + } + + /** + * Get the prometheusEndpoint property: Hostname or IP address where the Prometheus endpoint containing data about + * the managed Cassandra nodes can be reached. + * + * @return the prometheusEndpoint value. + */ + public SeedNode prometheusEndpoint() { + return this.prometheusEndpoint; + } + + /** + * Set the prometheusEndpoint property: Hostname or IP address where the Prometheus endpoint containing data about + * the managed Cassandra nodes can be reached. + * + * @param prometheusEndpoint the prometheusEndpoint value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withPrometheusEndpoint(SeedNode prometheusEndpoint) { + this.prometheusEndpoint = prometheusEndpoint; + return this; + } + + /** + * Get the repairEnabled property: Should automatic repairs run on this cluster? If omitted, this is true, and + * should stay true unless you are running a hybrid cluster where you are already doing your own repairs. + * + * @return the repairEnabled value. + */ + public Boolean repairEnabled() { + return this.repairEnabled; + } + + /** + * Set the repairEnabled property: Should automatic repairs run on this cluster? If omitted, this is true, and + * should stay true unless you are running a hybrid cluster where you are already doing your own repairs. + * + * @param repairEnabled the repairEnabled value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withRepairEnabled(Boolean repairEnabled) { + this.repairEnabled = repairEnabled; + return this; + } + + /** + * Get the clientCertificates property: List of TLS certificates used to authorize clients connecting to the + * cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is + * set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be + * validated from one or more of the public certificates in this property. + * + * @return the clientCertificates value. + */ + public List clientCertificates() { + return this.clientCertificates; + } + + /** + * Set the clientCertificates property: List of TLS certificates used to authorize clients connecting to the + * cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is + * set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be + * validated from one or more of the public certificates in this property. + * + * @param clientCertificates the clientCertificates value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withClientCertificates(List clientCertificates) { + this.clientCertificates = clientCertificates; + return this; + } + + /** + * Get the externalGossipCertificates property: List of TLS certificates used to authorize gossip from unmanaged + * data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the + * certificates provided in this property. + * + * @return the externalGossipCertificates value. + */ + public List externalGossipCertificates() { + return this.externalGossipCertificates; + } + + /** + * Set the externalGossipCertificates property: List of TLS certificates used to authorize gossip from unmanaged + * data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the + * certificates provided in this property. + * + * @param externalGossipCertificates the externalGossipCertificates value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withExternalGossipCertificates(List externalGossipCertificates) { + this.externalGossipCertificates = externalGossipCertificates; + return this; + } + + /** + * Get the gossipCertificates property: List of TLS certificates that unmanaged nodes must trust for gossip with + * managed nodes. All managed nodes will present TLS client certificates that are verifiable using one of the + * certificates provided in this property. + * + * @return the gossipCertificates value. + */ + public List gossipCertificates() { + return this.gossipCertificates; + } + + /** + * Get the externalSeedNodes property: List of IP addresses of seed nodes in unmanaged data centers. These will be + * added to the seed node lists of all managed nodes. + * + * @return the externalSeedNodes value. + */ + public List externalSeedNodes() { + return this.externalSeedNodes; + } + + /** + * Set the externalSeedNodes property: List of IP addresses of seed nodes in unmanaged data centers. These will be + * added to the seed node lists of all managed nodes. + * + * @param externalSeedNodes the externalSeedNodes value to set. + * @return the ClusterResourceProperties object itself. + */ + public ClusterResourceProperties withExternalSeedNodes(List externalSeedNodes) { + this.externalSeedNodes = externalSeedNodes; + return this; + } + + /** + * Get the seedNodes property: List of IP addresses of seed nodes in the managed data centers. These should be added + * to the seed node lists of all unmanaged nodes. + * + * @return the seedNodes value. + */ + public List seedNodes() { + return this.seedNodes; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (prometheusEndpoint() != null) { + prometheusEndpoint().validate(); + } + if (clientCertificates() != null) { + clientCertificates().forEach(e -> e.validate()); + } + if (externalGossipCertificates() != null) { + externalGossipCertificates().forEach(e -> e.validate()); + } + if (gossipCertificates() != null) { + gossipCertificates().forEach(e -> e.validate()); + } + if (externalSeedNodes() != null) { + externalSeedNodes().forEach(e -> e.validate()); + } + if (seedNodes() != null) { + seedNodes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java new file mode 100644 index 0000000000000..5ef43f34fa59a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitionRegions. */ +public interface CollectionPartitionRegions { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java new file mode 100644 index 0000000000000..c2ced7aa08128 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionPartitions.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionPartitions. */ +public interface CollectionPartitions { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition level usage request. + */ + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java new file mode 100644 index 0000000000000..f7a7f4b69194a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CollectionRegions.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CollectionRegions. */ +public interface CollectionRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java new file mode 100644 index 0000000000000..a448a505c4b26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Collections.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Collections. */ +public interface Collections { + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String filter, + Context context); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves metric definitions for the given collection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, String collectionRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java new file mode 100644 index 0000000000000..400b5b3f66fcd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Column.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Cassandra table column. */ +@Fluent +public final class Column { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Column.class); + + /* + * Name of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "name") + private String name; + + /* + * Type of the Cosmos DB Cassandra table column + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Name of the Cosmos DB Cassandra table column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Cosmos DB Cassandra table column. + * + * @param name the name value to set. + * @return the Column object itself. + */ + public Column withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Type of the Cosmos DB Cassandra table column. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the Cosmos DB Cassandra table column. + * + * @param type the type value to set. + * @return the Column object itself. + */ + public Column withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java new file mode 100644 index 0000000000000..dc27767bfb63f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePath.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CompositePath model. */ +@Fluent +public final class CompositePath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CompositePath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * Sort order for composite paths. + */ + @JsonProperty(value = "order") + private CompositePathSortOrder order; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the CompositePath object itself. + */ + public CompositePath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the order property: Sort order for composite paths. + * + * @return the order value. + */ + public CompositePathSortOrder order() { + return this.order; + } + + /** + * Set the order property: Sort order for composite paths. + * + * @param order the order value to set. + * @return the CompositePath object itself. + */ + public CompositePath withOrder(CompositePathSortOrder order) { + this.order = order; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java new file mode 100644 index 0000000000000..4f7252bf95a88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CompositePathSortOrder.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CompositePathSortOrder. */ +public final class CompositePathSortOrder extends ExpandableStringEnum { + /** Static value ascending for CompositePathSortOrder. */ + public static final CompositePathSortOrder ASCENDING = fromString("ascending"); + + /** Static value descending for CompositePathSortOrder. */ + public static final CompositePathSortOrder DESCENDING = fromString("descending"); + + /** + * Creates or finds a CompositePathSortOrder from its string representation. + * + * @param name a name to look for. + * @return the corresponding CompositePathSortOrder. + */ + @JsonCreator + public static CompositePathSortOrder fromString(String name) { + return fromString(name, CompositePathSortOrder.class); + } + + /** @return known CompositePathSortOrder values. */ + public static Collection values() { + return values(CompositePathSortOrder.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java new file mode 100644 index 0000000000000..e958cab4200fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConflictResolutionMode. */ +public final class ConflictResolutionMode extends ExpandableStringEnum { + /** Static value LastWriterWins for ConflictResolutionMode. */ + public static final ConflictResolutionMode LAST_WRITER_WINS = fromString("LastWriterWins"); + + /** Static value Custom for ConflictResolutionMode. */ + public static final ConflictResolutionMode CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ConflictResolutionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConflictResolutionMode. + */ + @JsonCreator + public static ConflictResolutionMode fromString(String name) { + return fromString(name, ConflictResolutionMode.class); + } + + /** @return known ConflictResolutionMode values. */ + public static Collection values() { + return values(ConflictResolutionMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java new file mode 100644 index 0000000000000..1b2ca71c84e39 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConflictResolutionPolicy.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The conflict resolution policy for the container. */ +@Fluent +public final class ConflictResolutionPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConflictResolutionPolicy.class); + + /* + * Indicates the conflict resolution mode. + */ + @JsonProperty(value = "mode") + private ConflictResolutionMode mode; + + /* + * The conflict resolution path in the case of LastWriterWins mode. + */ + @JsonProperty(value = "conflictResolutionPath") + private String conflictResolutionPath; + + /* + * The procedure to resolve conflicts in the case of custom mode. + */ + @JsonProperty(value = "conflictResolutionProcedure") + private String conflictResolutionProcedure; + + /** + * Get the mode property: Indicates the conflict resolution mode. + * + * @return the mode value. + */ + public ConflictResolutionMode mode() { + return this.mode; + } + + /** + * Set the mode property: Indicates the conflict resolution mode. + * + * @param mode the mode value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withMode(ConflictResolutionMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the conflictResolutionPath property: The conflict resolution path in the case of LastWriterWins mode. + * + * @return the conflictResolutionPath value. + */ + public String conflictResolutionPath() { + return this.conflictResolutionPath; + } + + /** + * Set the conflictResolutionPath property: The conflict resolution path in the case of LastWriterWins mode. + * + * @param conflictResolutionPath the conflictResolutionPath value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionPath(String conflictResolutionPath) { + this.conflictResolutionPath = conflictResolutionPath; + return this; + } + + /** + * Get the conflictResolutionProcedure property: The procedure to resolve conflicts in the case of custom mode. + * + * @return the conflictResolutionProcedure value. + */ + public String conflictResolutionProcedure() { + return this.conflictResolutionProcedure; + } + + /** + * Set the conflictResolutionProcedure property: The procedure to resolve conflicts in the case of custom mode. + * + * @param conflictResolutionProcedure the conflictResolutionProcedure value to set. + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionProcedure(String conflictResolutionProcedure) { + this.conflictResolutionProcedure = conflictResolutionProcedure; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java new file mode 100644 index 0000000000000..11f254b5a0e93 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConnectorOffer.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectorOffer. */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** Static value Small for ConnectorOffer. */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates or finds a ConnectorOffer from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectorOffer. + */ + @JsonCreator + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** @return known ConnectorOffer values. */ + public static Collection values() { + return values(ConnectorOffer.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java new file mode 100644 index 0000000000000..c55cb0f23b19a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ConsistencyPolicy.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The consistency policy for the Cosmos DB database account. */ +@Fluent +public final class ConsistencyPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConsistencyPolicy.class); + + /* + * The default consistency level and configuration settings of the Cosmos + * DB account. + */ + @JsonProperty(value = "defaultConsistencyLevel", required = true) + private DefaultConsistencyLevel defaultConsistencyLevel; + + /* + * When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for + * this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy + * is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxStalenessPrefix") + private Long maxStalenessPrefix; + + /* + * When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted + * range for this value is 5 - 86400. Required when + * defaultConsistencyPolicy is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxIntervalInSeconds") + private Integer maxIntervalInSeconds; + + /** + * Get the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos + * DB account. + * + * @return the defaultConsistencyLevel value. + */ + public DefaultConsistencyLevel defaultConsistencyLevel() { + return this.defaultConsistencyLevel; + } + + /** + * Set the defaultConsistencyLevel property: The default consistency level and configuration settings of the Cosmos + * DB account. + * + * @param defaultConsistencyLevel the defaultConsistencyLevel value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withDefaultConsistencyLevel(DefaultConsistencyLevel defaultConsistencyLevel) { + this.defaultConsistencyLevel = defaultConsistencyLevel; + return this; + } + + /** + * Get the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + * when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxStalenessPrefix value. + */ + public Long maxStalenessPrefix() { + return this.maxStalenessPrefix; + } + + /** + * Set the maxStalenessPrefix property: When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required + * when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxStalenessPrefix the maxStalenessPrefix value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxStalenessPrefix(Long maxStalenessPrefix) { + this.maxStalenessPrefix = maxStalenessPrefix; + return this; + } + + /** + * Get the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. + * Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxIntervalInSeconds value. + */ + public Integer maxIntervalInSeconds() { + return this.maxIntervalInSeconds; + } + + /** + * Set the maxIntervalInSeconds property: When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. + * Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxIntervalInSeconds the maxIntervalInSeconds value to set. + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxIntervalInSeconds(Integer maxIntervalInSeconds) { + this.maxIntervalInSeconds = maxIntervalInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (defaultConsistencyLevel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property defaultConsistencyLevel in model ConsistencyPolicy")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java new file mode 100644 index 0000000000000..48e374b9f4b98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContainerPartitionKey.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration of the partition key to be used for partitioning data into multiple partitions. */ +@Fluent +public final class ContainerPartitionKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerPartitionKey.class); + + /* + * List of paths using which data within the container can be partitioned + */ + @JsonProperty(value = "paths") + private List paths; + + /* + * Indicates the kind of algorithm used for partitioning. For MultiHash, + * multiple partition keys (upto three maximum) are supported for container + * create + */ + @JsonProperty(value = "kind") + private PartitionKind kind; + + /* + * Indicates the version of the partition key definition + */ + @JsonProperty(value = "version") + private Integer version; + + /* + * Indicates if the container is using a system generated partition key + */ + @JsonProperty(value = "systemKey", access = JsonProperty.Access.WRITE_ONLY) + private Boolean systemKey; + + /** + * Get the paths property: List of paths using which data within the container can be partitioned. + * + * @return the paths value. + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths property: List of paths using which data within the container can be partitioned. + * + * @param paths the paths value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Get the kind property: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition + * keys (upto three maximum) are supported for container create. + * + * @return the kind value. + */ + public PartitionKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition + * keys (upto three maximum) are supported for container create. + * + * @param kind the kind value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withKind(PartitionKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the version property: Indicates the version of the partition key definition. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the partition key definition. + * + * @param version the version value to set. + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withVersion(Integer version) { + this.version = version; + return this; + } + + /** + * Get the systemKey property: Indicates if the container is using a system generated partition key. + * + * @return the systemKey value. + */ + public Boolean systemKey() { + return this.systemKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java new file mode 100644 index 0000000000000..79c07023c5d1b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupInformation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the status of continuous backups. */ +@Fluent +public final class ContinuousBackupInformation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousBackupInformation.class); + + /* + * The latest restorable timestamp for a resource. + */ + @JsonProperty(value = "latestRestorableTimestamp") + private String latestRestorableTimestamp; + + /** + * Get the latestRestorableTimestamp property: The latest restorable timestamp for a resource. + * + * @return the latestRestorableTimestamp value. + */ + public String latestRestorableTimestamp() { + return this.latestRestorableTimestamp; + } + + /** + * Set the latestRestorableTimestamp property: The latest restorable timestamp for a resource. + * + * @param latestRestorableTimestamp the latestRestorableTimestamp value to set. + * @return the ContinuousBackupInformation object itself. + */ + public ContinuousBackupInformation withLatestRestorableTimestamp(String latestRestorableTimestamp) { + this.latestRestorableTimestamp = latestRestorableTimestamp; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java new file mode 100644 index 0000000000000..f16348feb6cf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousBackupRestoreLocation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the regional restorable account. */ +@Fluent +public final class ContinuousBackupRestoreLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousBackupRestoreLocation.class); + + /* + * The name of the continuous backup restore location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The name of the continuous backup restore location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The name of the continuous backup restore location. + * + * @param location the location value to set. + * @return the ContinuousBackupRestoreLocation object itself. + */ + public ContinuousBackupRestoreLocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java new file mode 100644 index 0000000000000..93ce2e5b59ff3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ContinuousModeBackupPolicy.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing continuous mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Continuous") +@Fluent +public final class ContinuousModeBackupPolicy extends BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContinuousModeBackupPolicy.class); + + /** {@inheritDoc} */ + @Override + public ContinuousModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java new file mode 100644 index 0000000000000..54409b10558d6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CorsPolicy.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CORS policy for the Cosmos DB database account. */ +@Fluent +public final class CorsPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CorsPolicy.class); + + /* + * The origin domains that are permitted to make a request against the + * service via CORS. + */ + @JsonProperty(value = "allowedOrigins", required = true) + private String allowedOrigins; + + /* + * The methods (HTTP request verbs) that the origin domain may use for a + * CORS request. + */ + @JsonProperty(value = "allowedMethods") + private String allowedMethods; + + /* + * The request headers that the origin domain may specify on the CORS + * request. + */ + @JsonProperty(value = "allowedHeaders") + private String allowedHeaders; + + /* + * The response headers that may be sent in the response to the CORS + * request and exposed by the browser to the request issuer. + */ + @JsonProperty(value = "exposedHeaders") + private String exposedHeaders; + + /* + * The maximum amount time that a browser should cache the preflight + * OPTIONS request. + */ + @JsonProperty(value = "maxAgeInSeconds") + private Long maxAgeInSeconds; + + /** + * Get the allowedOrigins property: The origin domains that are permitted to make a request against the service via + * CORS. + * + * @return the allowedOrigins value. + */ + public String allowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set the allowedOrigins property: The origin domains that are permitted to make a request against the service via + * CORS. + * + * @param allowedOrigins the allowedOrigins value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedOrigins(String allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + /** + * Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. + * + * @return the allowedMethods value. + */ + public String allowedMethods() { + return this.allowedMethods; + } + + /** + * Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. + * + * @param allowedMethods the allowedMethods value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedMethods(String allowedMethods) { + this.allowedMethods = allowedMethods; + return this; + } + + /** + * Get the allowedHeaders property: The request headers that the origin domain may specify on the CORS request. + * + * @return the allowedHeaders value. + */ + public String allowedHeaders() { + return this.allowedHeaders; + } + + /** + * Set the allowedHeaders property: The request headers that the origin domain may specify on the CORS request. + * + * @param allowedHeaders the allowedHeaders value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withAllowedHeaders(String allowedHeaders) { + this.allowedHeaders = allowedHeaders; + return this; + } + + /** + * Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @return the exposedHeaders value. + */ + public String exposedHeaders() { + return this.exposedHeaders; + } + + /** + * Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @param exposedHeaders the exposedHeaders value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withExposedHeaders(String exposedHeaders) { + this.exposedHeaders = exposedHeaders; + return this; + } + + /** + * Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @return the maxAgeInSeconds value. + */ + public Long maxAgeInSeconds() { + return this.maxAgeInSeconds; + } + + /** + * Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @param maxAgeInSeconds the maxAgeInSeconds value to set. + * @return the CorsPolicy object itself. + */ + public CorsPolicy withMaxAgeInSeconds(Long maxAgeInSeconds) { + this.maxAgeInSeconds = maxAgeInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allowedOrigins() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property allowedOrigins in model CorsPolicy")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java new file mode 100644 index 0000000000000..59c9362150d62 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateMode. */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** @return known CreateMode values. */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java new file mode 100644 index 0000000000000..7d0ad0cc2d62b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/CreateUpdateOptions.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", + * "If-None-Match", "Session-Token" and "Throughput". + */ +@Fluent +public final class CreateUpdateOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateUpdateOptions.class); + + /* + * Request Units per second. For example, "throughput": 10000. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettings autoscaleSettings; + + /** + * Get the throughput property: Request Units per second. For example, "throughput": 10000. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Request Units per second. For example, "throughput": 10000. + * + * @param throughput the throughput value to set. + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Specifies the Autoscale settings. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java new file mode 100644 index 0000000000000..a14cf2c4543fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResource.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; + +/** An immutable client-side representation of DataCenterResource. */ +public interface DataCenterResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Properties of a managed Cassandra data center. + * + * @return the properties value. + */ + DataCenterResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner object. + * + * @return the inner object. + */ + DataCenterResourceInner innerModel(); + + /** The entirety of the DataCenterResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataCenterResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCenterResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataCenterResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, clusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Managed Cassandra cluster name. + * @return the next definition stage. + */ + WithCreate withExistingCassandraCluster(String resourceGroupName, String clusterName); + } + /** + * The stage of the DataCenterResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCenterResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCenterResource create(Context context); + } + /** The stage of the DataCenterResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of a managed Cassandra data center.. + * + * @param properties Properties of a managed Cassandra data center. + * @return the next definition stage. + */ + WithCreate withProperties(DataCenterResourceProperties properties); + } + } + /** + * Begins update for the DataCenterResource resource. + * + * @return the stage of resource update. + */ + DataCenterResource.Update update(); + + /** The template for DataCenterResource update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataCenterResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataCenterResource apply(Context context); + } + /** The DataCenterResource update stages. */ + interface UpdateStages { + /** The stage of the DataCenterResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of a managed Cassandra data center.. + * + * @param properties Properties of a managed Cassandra data center. + * @return the next definition stage. + */ + Update withProperties(DataCenterResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCenterResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCenterResource refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResourceProperties.java new file mode 100644 index 0000000000000..7bdce665e7475 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataCenterResourceProperties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a managed Cassandra data center. */ +@Fluent +public final class DataCenterResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCenterResourceProperties.class); + + /* + * The status of the resource at the time the operation was called. + */ + @JsonProperty(value = "provisioningState") + private ManagedCassandraProvisioningState provisioningState; + + /* + * The region this data center should be created in. + */ + @JsonProperty(value = "dataCenterLocation") + private String dataCenterLocation; + + /* + * Resource id of a subnet the nodes in this data center should have their + * network interfaces connected to. The subnet must be in the same region + * specified in 'dataCenterLocation' and must be able to route to the + * subnet specified in the cluster's 'delegatedManagementSubnetId' + * property. This resource id will be of the form + * '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + */ + @JsonProperty(value = "delegatedSubnetId") + private String delegatedSubnetId; + + /* + * The number of nodes the data center should have. This is the desired + * number. After it is set, it may take some time for the data center to be + * scaled to match. To monitor the number of nodes and their status, use + * the fetchNodeStatus method on the cluster. + */ + @JsonProperty(value = "nodeCount") + private Integer nodeCount; + + /* + * IP addresses for seed nodes in this data center. This is for reference. + * Generally you will want to use the seedNodes property on the cluster, + * which aggregates the seed nodes from all data centers in the cluster. + */ + @JsonProperty(value = "seedNodes", access = JsonProperty.Access.WRITE_ONLY) + private List seedNodes; + + /* + * A fragment of a cassandra.yaml configuration file to be included in the + * cassandra.yaml for all nodes in this data center. The fragment should be + * Base64 encoded, and only a subset of keys are allowed. + */ + @JsonProperty(value = "base64EncodedCassandraYamlFragment") + private String base64EncodedCassandraYamlFragment; + + /** + * Get the provisioningState property: The status of the resource at the time the operation was called. + * + * @return the provisioningState value. + */ + public ManagedCassandraProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The status of the resource at the time the operation was called. + * + * @param provisioningState the provisioningState value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withProvisioningState(ManagedCassandraProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the dataCenterLocation property: The region this data center should be created in. + * + * @return the dataCenterLocation value. + */ + public String dataCenterLocation() { + return this.dataCenterLocation; + } + + /** + * Set the dataCenterLocation property: The region this data center should be created in. + * + * @param dataCenterLocation the dataCenterLocation value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withDataCenterLocation(String dataCenterLocation) { + this.dataCenterLocation = dataCenterLocation; + return this; + } + + /** + * Get the delegatedSubnetId property: Resource id of a subnet the nodes in this data center should have their + * network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must + * be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource + * id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource + * group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + * + * @return the delegatedSubnetId value. + */ + public String delegatedSubnetId() { + return this.delegatedSubnetId; + } + + /** + * Set the delegatedSubnetId property: Resource id of a subnet the nodes in this data center should have their + * network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must + * be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource + * id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource + * group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + * + * @param delegatedSubnetId the delegatedSubnetId value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withDelegatedSubnetId(String delegatedSubnetId) { + this.delegatedSubnetId = delegatedSubnetId; + return this; + } + + /** + * Get the nodeCount property: The number of nodes the data center should have. This is the desired number. After it + * is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their + * status, use the fetchNodeStatus method on the cluster. + * + * @return the nodeCount value. + */ + public Integer nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: The number of nodes the data center should have. This is the desired number. After it + * is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their + * status, use the fetchNodeStatus method on the cluster. + * + * @param nodeCount the nodeCount value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withNodeCount(Integer nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Get the seedNodes property: IP addresses for seed nodes in this data center. This is for reference. Generally you + * will want to use the seedNodes property on the cluster, which aggregates the seed nodes from all data centers in + * the cluster. + * + * @return the seedNodes value. + */ + public List seedNodes() { + return this.seedNodes; + } + + /** + * Get the base64EncodedCassandraYamlFragment property: A fragment of a cassandra.yaml configuration file to be + * included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only + * a subset of keys are allowed. + * + * @return the base64EncodedCassandraYamlFragment value. + */ + public String base64EncodedCassandraYamlFragment() { + return this.base64EncodedCassandraYamlFragment; + } + + /** + * Set the base64EncodedCassandraYamlFragment property: A fragment of a cassandra.yaml configuration file to be + * included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only + * a subset of keys are allowed. + * + * @param base64EncodedCassandraYamlFragment the base64EncodedCassandraYamlFragment value to set. + * @return the DataCenterResourceProperties object itself. + */ + public DataCenterResourceProperties withBase64EncodedCassandraYamlFragment( + String base64EncodedCassandraYamlFragment) { + this.base64EncodedCassandraYamlFragment = base64EncodedCassandraYamlFragment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (seedNodes() != null) { + seedNodes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java new file mode 100644 index 0000000000000..0be0a4ce7cb97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferRegionalServiceResource.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Resource for a regional service location. */ +@Immutable +public final class DataTransferRegionalServiceResource extends RegionalServiceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataTransferRegionalServiceResource.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java new file mode 100644 index 0000000000000..ae9802662a113 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataTransferServiceResourceProperties.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for DataTransferServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("DataTransfer") +@Fluent +public final class DataTransferServiceResourceProperties extends ServiceResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataTransferServiceResourceProperties.class); + + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public DataTransferServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataTransferServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java new file mode 100644 index 0000000000000..c279860e047f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DataType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataType. */ +public final class DataType extends ExpandableStringEnum { + /** Static value String for DataType. */ + public static final DataType STRING = fromString("String"); + + /** Static value Number for DataType. */ + public static final DataType NUMBER = fromString("Number"); + + /** Static value Point for DataType. */ + public static final DataType POINT = fromString("Point"); + + /** Static value Polygon for DataType. */ + public static final DataType POLYGON = fromString("Polygon"); + + /** Static value LineString for DataType. */ + public static final DataType LINE_STRING = fromString("LineString"); + + /** Static value MultiPolygon for DataType. */ + public static final DataType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a DataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataType. + */ + @JsonCreator + public static DataType fromString(String name) { + return fromString(name, DataType.class); + } + + /** @return known DataType values. */ + public static Collection values() { + return values(DataType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java new file mode 100644 index 0000000000000..214b9ed1dee1e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountConnectionString.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection string for the Cosmos DB account. */ +@Immutable +public final class DatabaseAccountConnectionString { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountConnectionString.class); + + /* + * Value of the connection string + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /* + * Description of the connection string + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the connectionString property: Value of the connection string. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the description property: Description of the connection string. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java new file mode 100644 index 0000000000000..af50aeb9c6324 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters to create and update Cosmos DB database accounts. */ +@Fluent +public final class DatabaseAccountCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountCreateUpdateParameters.class); + + /* + * Indicates the type of database account. This can only be set at database + * account creation. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /* + * Properties to create and update Azure Cosmos DB database accounts. + */ + @JsonProperty(value = "properties", required = true) + private DatabaseAccountCreateUpdateProperties innerProperties = new DatabaseAccountCreateUpdateProperties(); + + /** + * Get the kind property: Indicates the type of database account. This can only be set at database account creation. + * + * @return the kind value. + */ + public DatabaseAccountKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the type of database account. This can only be set at database account creation. + * + * @param kind the kind value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withKind(DatabaseAccountKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB database accounts. + * + * @return the innerProperties value. + */ + private DatabaseAccountCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseAccountCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().consistencyPolicy(); + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withConsistencyPolicy(consistencyPolicy); + return this; + } + + /** + * Get the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @return the locations value. + */ + public List locations() { + return this.innerProperties() == null ? null : this.innerProperties().locations(); + } + + /** + * Set the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @param locations the locations value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withLocations(List locations) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withLocations(locations); + return this; + } + + /** + * Get the databaseAccountOfferType property: The offer type for the database. + * + * @return the databaseAccountOfferType value. + */ + public String databaseAccountOfferType() { + return this.innerProperties() == null ? null : this.innerProperties().databaseAccountOfferType(); + } + + /** + * Set the databaseAccountOfferType property: The offer type for the database. + * + * @param databaseAccountOfferType the databaseAccountOfferType value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDatabaseAccountOfferType(String databaseAccountOfferType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withDatabaseAccountOfferType(databaseAccountOfferType); + return this; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.innerProperties() == null ? null : this.innerProperties().ipRules(); + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withIpRules(List ipRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withIpRules(ipRules); + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isVirtualNetworkFilterEnabled(); + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withIsVirtualNetworkFilterEnabled( + Boolean isVirtualNetworkFilterEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticFailover(); + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.innerProperties() == null ? null : this.innerProperties().capabilities(); + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCapabilities(List capabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withCapabilities(capabilities); + return this; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkRules(); + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withVirtualNetworkRules(List virtualNetworkRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withVirtualNetworkRules(virtualNetworkRules); + return this; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.innerProperties() == null ? null : this.innerProperties().enableMultipleWriteLocations(); + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableMultipleWriteLocations( + Boolean enableMultipleWriteLocations) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableMultipleWriteLocations(enableMultipleWriteLocations); + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.innerProperties() == null ? null : this.innerProperties().enableCassandraConnector(); + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableCassandraConnector(enableCassandraConnector); + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.innerProperties() == null ? null : this.innerProperties().connectorOffer(); + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withConnectorOffer(connectorOffer); + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.innerProperties() == null ? null : this.innerProperties().disableKeyBasedMetadataWriteAccess(); + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.innerProperties() == null ? null : this.innerProperties().keyVaultKeyUri(); + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withKeyVaultKeyUri(String keyVaultKeyUri) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withKeyVaultKeyUri(keyVaultKeyUri); + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().defaultIdentity(); + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDefaultIdentity(String defaultIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withDefaultIdentity(defaultIdentity); + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.innerProperties() == null ? null : this.innerProperties().enableFreeTier(); + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableFreeTier(Boolean enableFreeTier) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableFreeTier(enableFreeTier); + return this; + } + + /** + * Get the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.innerProperties() == null ? null : this.innerProperties().apiProperties(); + } + + /** + * Set the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withApiProperties(ApiProperties apiProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withApiProperties(apiProperties); + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.innerProperties() == null ? null : this.innerProperties().enableAnalyticalStorage(); + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withEnableAnalyticalStorage(enableAnalyticalStorage); + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().analyticalStorageConfiguration(); + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withAnalyticalStorageConfiguration(analyticalStorageConfiguration); + return this; + } + + /** + * Get the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: Enum to indicate the mode of account creation. + * + * @param createMode the createMode value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().backupPolicy(); + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withBackupPolicy(BackupPolicy backupPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withBackupPolicy(backupPolicy); + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.innerProperties() == null ? null : this.innerProperties().cors(); + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCors(List cors) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withCors(cors); + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypass(); + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withNetworkAclBypass(networkAclBypass); + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypassResourceIds(); + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withNetworkAclBypassResourceIds( + List networkAclBypassResourceIds) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withNetworkAclBypassResourceIds(networkAclBypassResourceIds); + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticLogSettings(); + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDiagnosticLogSettings( + DiagnosticLogSettings diagnosticLogSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withDiagnosticLogSettings(diagnosticLogSettings); + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + + /** + * Get the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + public RestoreParameters restoreParameters() { + return this.innerProperties() == null ? null : this.innerProperties().restoreParameters(); + } + + /** + * Set the restoreParameters property: Parameters to indicate the information about the restore. + * + * @param restoreParameters the restoreParameters value to set. + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withRestoreParameters(RestoreParameters restoreParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountCreateUpdateProperties(); + } + this.innerProperties().withRestoreParameters(restoreParameters); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model DatabaseAccountCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java new file mode 100644 index 0000000000000..6e9bcff7fe7da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountGetResults.java @@ -0,0 +1,1266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DatabaseAccountGetResults. */ +public interface DatabaseAccountGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the kind property: Indicates the type of database account. This can only be set at database account + * creation. + * + * @return the kind value. + */ + DatabaseAccountKind kind(); + + /** + * Gets the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the Cosmos DB account at the time the operation was called. + * The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in + * Creating state, only properties that are specified as input for the Create Cosmos DB account operation are + * returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being + * updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. + * 'DeletionFailed' – the Cosmos DB account deletion failed. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the documentEndpoint property: The connection endpoint for the Cosmos DB database account. + * + * @return the documentEndpoint value. + */ + String documentEndpoint(); + + /** + * Gets the databaseAccountOfferType property: The offer type for the Cosmos DB database account. Default value: + * Standard. + * + * @return the databaseAccountOfferType value. + */ + DatabaseAccountOfferType databaseAccountOfferType(); + + /** + * Gets the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + List ipRules(); + + /** + * Gets the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + Boolean isVirtualNetworkFilterEnabled(); + + /** + * Gets the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + Boolean enableAutomaticFailover(); + + /** + * Gets the consistencyPolicy property: The consistency policy for the Cosmos DB database account. + * + * @return the consistencyPolicy value. + */ + ConsistencyPolicy consistencyPolicy(); + + /** + * Gets the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the writeLocations property: An array that contains the write location for the Cosmos DB account. + * + * @return the writeLocations value. + */ + List writeLocations(); + + /** + * Gets the readLocations property: An array that contains of the read locations enabled for the Cosmos DB account. + * + * @return the readLocations value. + */ + List readLocations(); + + /** + * Gets the locations property: An array that contains all of the locations enabled for the Cosmos DB account. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the failoverPolicies property: An array that contains the regions ordered by their failover priorities. + * + * @return the failoverPolicies value. + */ + List failoverPolicies(); + + /** + * Gets the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + List virtualNetworkRules(); + + /** + * Gets the privateEndpointConnections property: List of Private Endpoint Connections configured for the Cosmos DB + * account. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + Boolean enableMultipleWriteLocations(); + + /** + * Gets the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + Boolean enableCassandraConnector(); + + /** + * Gets the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + ConnectorOffer connectorOffer(); + + /** + * Gets the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + Boolean disableKeyBasedMetadataWriteAccess(); + + /** + * Gets the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + String keyVaultKeyUri(); + + /** + * Gets the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + String defaultIdentity(); + + /** + * Gets the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + Boolean enableFreeTier(); + + /** + * Gets the apiProperties property: API specific properties. + * + * @return the apiProperties value. + */ + ApiProperties apiProperties(); + + /** + * Gets the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + Boolean enableAnalyticalStorage(); + + /** + * Gets the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + AnalyticalStorageConfiguration analyticalStorageConfiguration(); + + /** + * Gets the instanceId property: A unique identifier assigned to the database account. + * + * @return the instanceId value. + */ + String instanceId(); + + /** + * Gets the createMode property: Enum to indicate the mode of account creation. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the restoreParameters property: Parameters to indicate the information about the restore. + * + * @return the restoreParameters value. + */ + RestoreParameters restoreParameters(); + + /** + * Gets the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + BackupPolicy backupPolicy(); + + /** + * Gets the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + List cors(); + + /** + * Gets the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + NetworkAclBypass networkAclBypass(); + + /** + * Gets the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + List networkAclBypassResourceIds(); + + /** + * Gets the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + DiagnosticLogSettings diagnosticLogSettings(); + + /** + * Gets the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + Boolean disableLocalAuth(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner object. + * + * @return the inner object. + */ + DatabaseAccountGetResultsInner innerModel(); + + /** The entirety of the DatabaseAccountGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithLocations, + DefinitionStages.WithCreateMode, + DefinitionStages.WithCreate { + } + /** The DatabaseAccountGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseAccountGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithLocations withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: An array that contains the georeplication locations enabled for the + * Cosmos DB account.. + * + * @param locations An array that contains the georeplication locations enabled for the Cosmos DB account. + * @return the next definition stage. + */ + WithCreateMode withLocations(List locations); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: Enum to indicate the mode of account creation.. + * + * @param createMode Enum to indicate the mode of account creation. + * @return the next definition stage. + */ + WithCreate withCreateMode(CreateMode createMode); + } + /** + * The stage of the DatabaseAccountGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithKind, + DefinitionStages.WithConsistencyPolicy, + DefinitionStages.WithIpRules, + DefinitionStages.WithIsVirtualNetworkFilterEnabled, + DefinitionStages.WithEnableAutomaticFailover, + DefinitionStages.WithCapabilities, + DefinitionStages.WithVirtualNetworkRules, + DefinitionStages.WithEnableMultipleWriteLocations, + DefinitionStages.WithEnableCassandraConnector, + DefinitionStages.WithConnectorOffer, + DefinitionStages.WithDisableKeyBasedMetadataWriteAccess, + DefinitionStages.WithKeyVaultKeyUri, + DefinitionStages.WithDefaultIdentity, + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithEnableFreeTier, + DefinitionStages.WithApiProperties, + DefinitionStages.WithEnableAnalyticalStorage, + DefinitionStages.WithAnalyticalStorageConfiguration, + DefinitionStages.WithBackupPolicy, + DefinitionStages.WithCors, + DefinitionStages.WithNetworkAclBypass, + DefinitionStages.WithNetworkAclBypassResourceIds, + DefinitionStages.WithDiagnosticLogSettings, + DefinitionStages.WithDisableLocalAuth, + DefinitionStages.WithRestoreParameters { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseAccountGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseAccountGetResults create(Context context); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Indicates the type of database account. This can only be set at database + * account creation.. + * + * @param kind Indicates the type of database account. This can only be set at database account creation. + * @return the next definition stage. + */ + WithCreate withKind(DatabaseAccountKind kind); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify consistencyPolicy. */ + interface WithConsistencyPolicy { + /** + * Specifies the consistencyPolicy property: The consistency policy for the Cosmos DB account.. + * + * @param consistencyPolicy The consistency policy for the Cosmos DB account. + * @return the next definition stage. + */ + WithCreate withConsistencyPolicy(ConsistencyPolicy consistencyPolicy); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify ipRules. */ + interface WithIpRules { + /** + * Specifies the ipRules property: List of IpRules.. + * + * @param ipRules List of IpRules. + * @return the next definition stage. + */ + WithCreate withIpRules(List ipRules); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify isVirtualNetworkFilterEnabled. */ + interface WithIsVirtualNetworkFilterEnabled { + /** + * Specifies the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual + * Network ACL rules.. + * + * @param isVirtualNetworkFilterEnabled Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * @return the next definition stage. + */ + WithCreate withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify enableAutomaticFailover. */ + interface WithEnableAutomaticFailover { + /** + * Specifies the enableAutomaticFailover property: Enables automatic failover of the write region in the + * rare event that the region is unavailable due to an outage. Automatic failover will result in a new write + * region for the account and is chosen based on the failover priorities configured for the account.. + * + * @param enableAutomaticFailover Enables automatic failover of the write region in the rare event that the + * region is unavailable due to an outage. Automatic failover will result in a new write region for the + * account and is chosen based on the failover priorities configured for the account. + * @return the next definition stage. + */ + WithCreate withEnableAutomaticFailover(Boolean enableAutomaticFailover); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify capabilities. */ + interface WithCapabilities { + /** + * Specifies the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities List of Cosmos DB capabilities for the account. + * @return the next definition stage. + */ + WithCreate withCapabilities(List capabilities); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify virtualNetworkRules. */ + interface WithVirtualNetworkRules { + /** + * Specifies the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos + * DB account.. + * + * @param virtualNetworkRules List of Virtual Network ACL rules configured for the Cosmos DB account. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkRules(List virtualNetworkRules); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify enableMultipleWriteLocations. */ + interface WithEnableMultipleWriteLocations { + /** + * Specifies the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations Enables the account to write in multiple locations. + * @return the next definition stage. + */ + WithCreate withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify enableCassandraConnector. */ + interface WithEnableCassandraConnector { + /** + * Specifies the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* + * account. + * + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account. + * @return the next definition stage. + */ + WithCreate withEnableCassandraConnector(Boolean enableCassandraConnector); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify connectorOffer. */ + interface WithConnectorOffer { + /** + * Specifies the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* + * account.. + * + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. + * @return the next definition stage. + */ + WithCreate withConnectorOffer(ConnectorOffer connectorOffer); + } + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify disableKeyBasedMetadataWriteAccess. + */ + interface WithDisableKeyBasedMetadataWriteAccess { + /** + * Specifies the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources + * (databases, containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * @return the next definition stage. + */ + WithCreate withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify keyVaultKeyUri. */ + interface WithKeyVaultKeyUri { + /** + * Specifies the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri The URI of the key vault. + * @return the next definition stage. + */ + WithCreate withKeyVaultKeyUri(String keyVaultKeyUri); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify defaultIdentity. */ + interface WithDefaultIdentity { + /** + * Specifies the defaultIdentity property: The default identity for accessing key vault used in features + * like customer managed keys. The default identity needs to be explicitly set by the users. It can be + * "FirstPartyIdentity", "SystemAssignedIdentity" and more.. + * + * @param defaultIdentity The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be + * "FirstPartyIdentity", "SystemAssignedIdentity" and more. + * @return the next definition stage. + */ + WithCreate withDefaultIdentity(String defaultIdentity); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess Whether requests from Public Network are allowed. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify enableFreeTier. */ + interface WithEnableFreeTier { + /** + * Specifies the enableFreeTier property: Flag to indicate whether Free Tier is enabled.. + * + * @param enableFreeTier Flag to indicate whether Free Tier is enabled. + * @return the next definition stage. + */ + WithCreate withEnableFreeTier(Boolean enableFreeTier); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify apiProperties. */ + interface WithApiProperties { + /** + * Specifies the apiProperties property: API specific properties. Currently, supported only for MongoDB + * API.. + * + * @param apiProperties API specific properties. Currently, supported only for MongoDB API. + * @return the next definition stage. + */ + WithCreate withApiProperties(ApiProperties apiProperties); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify enableAnalyticalStorage. */ + interface WithEnableAnalyticalStorage { + /** + * Specifies the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics.. + * + * @param enableAnalyticalStorage Flag to indicate whether to enable storage analytics. + * @return the next definition stage. + */ + WithCreate withEnableAnalyticalStorage(Boolean enableAnalyticalStorage); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify analyticalStorageConfiguration. */ + interface WithAnalyticalStorageConfiguration { + /** + * Specifies the analyticalStorageConfiguration property: Analytical storage specific properties.. + * + * @param analyticalStorageConfiguration Analytical storage specific properties. + * @return the next definition stage. + */ + WithCreate withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify backupPolicy. */ + interface WithBackupPolicy { + /** + * Specifies the backupPolicy property: The object representing the policy for taking backups on an + * account.. + * + * @param backupPolicy The object representing the policy for taking backups on an account. + * @return the next definition stage. + */ + WithCreate withBackupPolicy(BackupPolicy backupPolicy); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify cors. */ + interface WithCors { + /** + * Specifies the cors property: The CORS policy for the Cosmos DB database account.. + * + * @param cors The CORS policy for the Cosmos DB database account. + * @return the next definition stage. + */ + WithCreate withCors(List cors); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify networkAclBypass. */ + interface WithNetworkAclBypass { + /** + * Specifies the networkAclBypass property: Indicates what services are allowed to bypass firewall checks.. + * + * @param networkAclBypass Indicates what services are allowed to bypass firewall checks. + * @return the next definition stage. + */ + WithCreate withNetworkAclBypass(NetworkAclBypass networkAclBypass); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify networkAclBypassResourceIds. */ + interface WithNetworkAclBypassResourceIds { + /** + * Specifies the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network + * Acl Bypass for the Cosmos DB account.. + * + * @param networkAclBypassResourceIds An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + * @return the next definition stage. + */ + WithCreate withNetworkAclBypassResourceIds(List networkAclBypassResourceIds); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify diagnosticLogSettings. */ + interface WithDiagnosticLogSettings { + /** + * Specifies the diagnosticLogSettings property: The Object representing the different Diagnostic log + * settings for the Cosmos DB Account.. + * + * @param diagnosticLogSettings The Object representing the different Diagnostic log settings for the Cosmos + * DB Account. + * @return the next definition stage. + */ + WithCreate withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify disableLocalAuth. */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can + * be used exclusively for authentication.. + * + * @param disableLocalAuth Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * @return the next definition stage. + */ + WithCreate withDisableLocalAuth(Boolean disableLocalAuth); + } + /** The stage of the DatabaseAccountGetResults definition allowing to specify restoreParameters. */ + interface WithRestoreParameters { + /** + * Specifies the restoreParameters property: Parameters to indicate the information about the restore.. + * + * @param restoreParameters Parameters to indicate the information about the restore. + * @return the next definition stage. + */ + WithCreate withRestoreParameters(RestoreParameters restoreParameters); + } + } + /** + * Begins update for the DatabaseAccountGetResults resource. + * + * @return the stage of resource update. + */ + DatabaseAccountGetResults.Update update(); + + /** The template for DatabaseAccountGetResults update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithConsistencyPolicy, + UpdateStages.WithLocations, + UpdateStages.WithIpRules, + UpdateStages.WithIsVirtualNetworkFilterEnabled, + UpdateStages.WithEnableAutomaticFailover, + UpdateStages.WithCapabilities, + UpdateStages.WithVirtualNetworkRules, + UpdateStages.WithEnableMultipleWriteLocations, + UpdateStages.WithEnableCassandraConnector, + UpdateStages.WithConnectorOffer, + UpdateStages.WithDisableKeyBasedMetadataWriteAccess, + UpdateStages.WithKeyVaultKeyUri, + UpdateStages.WithDefaultIdentity, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithEnableFreeTier, + UpdateStages.WithApiProperties, + UpdateStages.WithEnableAnalyticalStorage, + UpdateStages.WithAnalyticalStorageConfiguration, + UpdateStages.WithBackupPolicy, + UpdateStages.WithCors, + UpdateStages.WithNetworkAclBypass, + UpdateStages.WithNetworkAclBypassResourceIds, + UpdateStages.WithDiagnosticLogSettings, + UpdateStages.WithDisableLocalAuth { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseAccountGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseAccountGetResults apply(Context context); + } + /** The DatabaseAccountGetResults update stages. */ + interface UpdateStages { + /** The stage of the DatabaseAccountGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags are a list of key-value pairs that describe the resource. These tags + * can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be + * provided for a resource. Each tag must have a key no greater than 128 characters and value no greater + * than 256 characters. For example, the default experience for a template type is set with + * "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", + * "DocumentDB", and "MongoDB".. + * + * @param tags Tags are a list of key-value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for + * a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 + * characters. For example, the default experience for a template type is set with "defaultExperience": + * "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and + * "MongoDB". + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify consistencyPolicy. */ + interface WithConsistencyPolicy { + /** + * Specifies the consistencyPolicy property: The consistency policy for the Cosmos DB account.. + * + * @param consistencyPolicy The consistency policy for the Cosmos DB account. + * @return the next definition stage. + */ + Update withConsistencyPolicy(ConsistencyPolicy consistencyPolicy); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: An array that contains the georeplication locations enabled for the + * Cosmos DB account.. + * + * @param locations An array that contains the georeplication locations enabled for the Cosmos DB account. + * @return the next definition stage. + */ + Update withLocations(List locations); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify ipRules. */ + interface WithIpRules { + /** + * Specifies the ipRules property: List of IpRules.. + * + * @param ipRules List of IpRules. + * @return the next definition stage. + */ + Update withIpRules(List ipRules); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify isVirtualNetworkFilterEnabled. */ + interface WithIsVirtualNetworkFilterEnabled { + /** + * Specifies the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual + * Network ACL rules.. + * + * @param isVirtualNetworkFilterEnabled Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * @return the next definition stage. + */ + Update withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify enableAutomaticFailover. */ + interface WithEnableAutomaticFailover { + /** + * Specifies the enableAutomaticFailover property: Enables automatic failover of the write region in the + * rare event that the region is unavailable due to an outage. Automatic failover will result in a new write + * region for the account and is chosen based on the failover priorities configured for the account.. + * + * @param enableAutomaticFailover Enables automatic failover of the write region in the rare event that the + * region is unavailable due to an outage. Automatic failover will result in a new write region for the + * account and is chosen based on the failover priorities configured for the account. + * @return the next definition stage. + */ + Update withEnableAutomaticFailover(Boolean enableAutomaticFailover); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify capabilities. */ + interface WithCapabilities { + /** + * Specifies the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities List of Cosmos DB capabilities for the account. + * @return the next definition stage. + */ + Update withCapabilities(List capabilities); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify virtualNetworkRules. */ + interface WithVirtualNetworkRules { + /** + * Specifies the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos + * DB account.. + * + * @param virtualNetworkRules List of Virtual Network ACL rules configured for the Cosmos DB account. + * @return the next definition stage. + */ + Update withVirtualNetworkRules(List virtualNetworkRules); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify enableMultipleWriteLocations. */ + interface WithEnableMultipleWriteLocations { + /** + * Specifies the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations Enables the account to write in multiple locations. + * @return the next definition stage. + */ + Update withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify enableCassandraConnector. */ + interface WithEnableCassandraConnector { + /** + * Specifies the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* + * account. + * + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account. + * @return the next definition stage. + */ + Update withEnableCassandraConnector(Boolean enableCassandraConnector); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify connectorOffer. */ + interface WithConnectorOffer { + /** + * Specifies the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* + * account.. + * + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. + * @return the next definition stage. + */ + Update withConnectorOffer(ConnectorOffer connectorOffer); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify disableKeyBasedMetadataWriteAccess. */ + interface WithDisableKeyBasedMetadataWriteAccess { + /** + * Specifies the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources + * (databases, containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * @return the next definition stage. + */ + Update withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify keyVaultKeyUri. */ + interface WithKeyVaultKeyUri { + /** + * Specifies the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri The URI of the key vault. + * @return the next definition stage. + */ + Update withKeyVaultKeyUri(String keyVaultKeyUri); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify defaultIdentity. */ + interface WithDefaultIdentity { + /** + * Specifies the defaultIdentity property: The default identity for accessing key vault used in features + * like customer managed keys. The default identity needs to be explicitly set by the users. It can be + * "FirstPartyIdentity", "SystemAssignedIdentity" and more.. + * + * @param defaultIdentity The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be + * "FirstPartyIdentity", "SystemAssignedIdentity" and more. + * @return the next definition stage. + */ + Update withDefaultIdentity(String defaultIdentity); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess Whether requests from Public Network are allowed. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify enableFreeTier. */ + interface WithEnableFreeTier { + /** + * Specifies the enableFreeTier property: Flag to indicate whether Free Tier is enabled.. + * + * @param enableFreeTier Flag to indicate whether Free Tier is enabled. + * @return the next definition stage. + */ + Update withEnableFreeTier(Boolean enableFreeTier); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify apiProperties. */ + interface WithApiProperties { + /** + * Specifies the apiProperties property: API specific properties. Currently, supported only for MongoDB + * API.. + * + * @param apiProperties API specific properties. Currently, supported only for MongoDB API. + * @return the next definition stage. + */ + Update withApiProperties(ApiProperties apiProperties); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify enableAnalyticalStorage. */ + interface WithEnableAnalyticalStorage { + /** + * Specifies the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics.. + * + * @param enableAnalyticalStorage Flag to indicate whether to enable storage analytics. + * @return the next definition stage. + */ + Update withEnableAnalyticalStorage(Boolean enableAnalyticalStorage); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify analyticalStorageConfiguration. */ + interface WithAnalyticalStorageConfiguration { + /** + * Specifies the analyticalStorageConfiguration property: Analytical storage specific properties.. + * + * @param analyticalStorageConfiguration Analytical storage specific properties. + * @return the next definition stage. + */ + Update withAnalyticalStorageConfiguration(AnalyticalStorageConfiguration analyticalStorageConfiguration); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify backupPolicy. */ + interface WithBackupPolicy { + /** + * Specifies the backupPolicy property: The object representing the policy for taking backups on an + * account.. + * + * @param backupPolicy The object representing the policy for taking backups on an account. + * @return the next definition stage. + */ + Update withBackupPolicy(BackupPolicy backupPolicy); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify cors. */ + interface WithCors { + /** + * Specifies the cors property: The CORS policy for the Cosmos DB database account.. + * + * @param cors The CORS policy for the Cosmos DB database account. + * @return the next definition stage. + */ + Update withCors(List cors); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify networkAclBypass. */ + interface WithNetworkAclBypass { + /** + * Specifies the networkAclBypass property: Indicates what services are allowed to bypass firewall checks.. + * + * @param networkAclBypass Indicates what services are allowed to bypass firewall checks. + * @return the next definition stage. + */ + Update withNetworkAclBypass(NetworkAclBypass networkAclBypass); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify networkAclBypassResourceIds. */ + interface WithNetworkAclBypassResourceIds { + /** + * Specifies the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network + * Acl Bypass for the Cosmos DB account.. + * + * @param networkAclBypassResourceIds An array that contains the Resource Ids for Network Acl Bypass for the + * Cosmos DB account. + * @return the next definition stage. + */ + Update withNetworkAclBypassResourceIds(List networkAclBypassResourceIds); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify diagnosticLogSettings. */ + interface WithDiagnosticLogSettings { + /** + * Specifies the diagnosticLogSettings property: The Object representing the different Diagnostic log + * settings for the Cosmos DB Account.. + * + * @param diagnosticLogSettings The Object representing the different Diagnostic log settings for the Cosmos + * DB Account. + * @return the next definition stage. + */ + Update withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings); + } + /** The stage of the DatabaseAccountGetResults update allowing to specify disableLocalAuth. */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can + * be used exclusively for authentication.. + * + * @param disableLocalAuth Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * @return the next definition stage. + */ + Update withDisableLocalAuth(Boolean disableLocalAuth); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseAccountGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseAccountGetResults refresh(Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(FailoverPolicies failoverParameters, Context context); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + DatabaseAccountListKeysResult listKeys(); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + Response listKeysWithResponse(Context context); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + DatabaseAccountListConnectionStringsResult listConnectionStrings(); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + Response listConnectionStringsWithResponse(Context context); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(RegionForOnlineOffline regionParameterForOffline, Context context); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response listReadOnlyKeysWithResponse(Context context); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey(DatabaseAccountRegenerateKeyParameters keyToRegenerate, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java new file mode 100644 index 0000000000000..deeecee5001c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseAccountKind. */ +public final class DatabaseAccountKind extends ExpandableStringEnum { + /** Static value GlobalDocumentDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind GLOBAL_DOCUMENT_DB = fromString("GlobalDocumentDB"); + + /** Static value MongoDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind MONGO_DB = fromString("MongoDB"); + + /** Static value Parse for DatabaseAccountKind. */ + public static final DatabaseAccountKind PARSE = fromString("Parse"); + + /** + * Creates or finds a DatabaseAccountKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseAccountKind. + */ + @JsonCreator + public static DatabaseAccountKind fromString(String name) { + return fromString(name, DatabaseAccountKind.class); + } + + /** @return known DatabaseAccountKind values. */ + public static Collection values() { + return values(DatabaseAccountKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java new file mode 100644 index 0000000000000..e6e13dcddb379 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListConnectionStringsResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseAccountListConnectionStringsResult. */ +public interface DatabaseAccountListConnectionStringsResult { + /** + * Gets the connectionStrings property: An array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value. + */ + List connectionStrings(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListConnectionStringsResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListConnectionStringsResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java new file mode 100644 index 0000000000000..224abe8747755 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListKeysResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListKeysResult. */ +public interface DatabaseAccountListKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the primaryMasterKey property: Base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value. + */ + String primaryMasterKey(); + + /** + * Gets the secondaryMasterKey property: Base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value. + */ + String secondaryMasterKey(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListKeysResultInner + * object. + * + * @return the inner object. + */ + DatabaseAccountListKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java new file mode 100644 index 0000000000000..a364359a8c09d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountListReadOnlyKeysResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner; + +/** An immutable client-side representation of DatabaseAccountListReadOnlyKeysResult. */ +public interface DatabaseAccountListReadOnlyKeysResult { + /** + * Gets the primaryReadonlyMasterKey property: Base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * Gets the secondaryReadonlyMasterKey property: Base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountListReadOnlyKeysResultInner object. + * + * @return the inner object. + */ + DatabaseAccountListReadOnlyKeysResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java new file mode 100644 index 0000000000000..ab49eceb6dcd5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountOfferType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DatabaseAccountOfferType. */ +public enum DatabaseAccountOfferType { + /** Enum value Standard. */ + STANDARD("Standard"); + + /** The actual serialized value for a DatabaseAccountOfferType instance. */ + private final String value; + + DatabaseAccountOfferType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DatabaseAccountOfferType instance. + * + * @param value the serialized value to parse. + * @return the parsed DatabaseAccountOfferType object, or null if unable to parse. + */ + @JsonCreator + public static DatabaseAccountOfferType fromString(String value) { + DatabaseAccountOfferType[] items = DatabaseAccountOfferType.values(); + for (DatabaseAccountOfferType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..d6a0c08c2af76 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegenerateKeyParameters.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to regenerate the keys within the database account. */ +@Fluent +public final class DatabaseAccountRegenerateKeyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountRegenerateKeyParameters.class); + + /* + * The access key to regenerate. + */ + @JsonProperty(value = "keyKind", required = true) + private KeyKind keyKind; + + /** + * Get the keyKind property: The access key to regenerate. + * + * @return the keyKind value. + */ + public KeyKind keyKind() { + return this.keyKind; + } + + /** + * Set the keyKind property: The access key to regenerate. + * + * @param keyKind the keyKind value to set. + * @return the DatabaseAccountRegenerateKeyParameters object itself. + */ + public DatabaseAccountRegenerateKeyParameters withKeyKind(KeyKind keyKind) { + this.keyKind = keyKind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyKind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyKind in model DatabaseAccountRegenerateKeyParameters")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java new file mode 100644 index 0000000000000..d9350f1bd6e89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountRegions.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAccountRegions. */ +public interface DatabaseAccountRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String region, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String region, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java new file mode 100644 index 0000000000000..033fd2ea48bae --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountUpdateParameters.java @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters for patching Azure Cosmos DB database account properties. */ +@Fluent +public final class DatabaseAccountUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountUpdateParameters.class); + + /* + * Tags are a list of key-value pairs that describe the resource. These + * tags can be used in viewing and grouping this resource (across resource + * groups). A maximum of 15 tags can be provided for a resource. Each tag + * must have a key no greater than 128 characters and value no greater than + * 256 characters. For example, the default experience for a template type + * is set with "defaultExperience": "Cassandra". Current + * "defaultExperience" values also include "Table", "Graph", "DocumentDB", + * and "MongoDB". + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Properties to update Azure Cosmos DB database accounts. + */ + @JsonProperty(value = "properties") + private DatabaseAccountUpdateProperties innerProperties; + + /** + * Get the tags property: Tags are a list of key-value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. + * Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + * the default experience for a template type is set with "defaultExperience": "Cassandra". Current + * "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags are a list of key-value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. + * Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + * the default experience for a template type is set with "defaultExperience": "Cassandra". Current + * "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + * + * @param tags the tags value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location property: The location of the resource group to which the resource belongs. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource group to which the resource belongs. + * + * @param location the location value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Properties to update Azure Cosmos DB database accounts. + * + * @return the innerProperties value. + */ + private DatabaseAccountUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value. + */ + public ConsistencyPolicy consistencyPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().consistencyPolicy(); + } + + /** + * Set the consistencyPolicy property: The consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withConsistencyPolicy(consistencyPolicy); + return this; + } + + /** + * Get the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @return the locations value. + */ + public List locations() { + return this.innerProperties() == null ? null : this.innerProperties().locations(); + } + + /** + * Set the locations property: An array that contains the georeplication locations enabled for the Cosmos DB + * account. + * + * @param locations the locations value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withLocations(List locations) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withLocations(locations); + return this; + } + + /** + * Get the ipRules property: List of IpRules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.innerProperties() == null ? null : this.innerProperties().ipRules(); + } + + /** + * Set the ipRules property: List of IpRules. + * + * @param ipRules the ipRules value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withIpRules(List ipRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withIpRules(ipRules); + return this; + } + + /** + * Get the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @return the isVirtualNetworkFilterEnabled value. + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isVirtualNetworkFilterEnabled(); + } + + /** + * Set the isVirtualNetworkFilterEnabled property: Flag to indicate whether to enable/disable Virtual Network ACL + * rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } + + /** + * Get the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value. + */ + public Boolean enableAutomaticFailover() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticFailover(); + } + + /** + * Set the enableAutomaticFailover property: Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will result in a new write region for the account + * and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } + + /** + * Get the capabilities property: List of Cosmos DB capabilities for the account. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.innerProperties() == null ? null : this.innerProperties().capabilities(); + } + + /** + * Set the capabilities property: List of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withCapabilities(List capabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withCapabilities(capabilities); + return this; + } + + /** + * Get the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkRules(); + } + + /** + * Set the virtualNetworkRules property: List of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withVirtualNetworkRules(List virtualNetworkRules) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withVirtualNetworkRules(virtualNetworkRules); + return this; + } + + /** + * Get the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value. + */ + public Boolean enableMultipleWriteLocations() { + return this.innerProperties() == null ? null : this.innerProperties().enableMultipleWriteLocations(); + } + + /** + * Set the enableMultipleWriteLocations property: Enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableMultipleWriteLocations(enableMultipleWriteLocations); + return this; + } + + /** + * Get the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value. + */ + public Boolean enableCassandraConnector() { + return this.innerProperties() == null ? null : this.innerProperties().enableCassandraConnector(); + } + + /** + * Set the enableCassandraConnector property: Enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableCassandraConnector(enableCassandraConnector); + return this; + } + + /** + * Get the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @return the connectorOffer value. + */ + public ConnectorOffer connectorOffer() { + return this.innerProperties() == null ? null : this.innerProperties().connectorOffer(); + } + + /** + * Set the connectorOffer property: The cassandra connector offer type for the Cosmos DB database C* account. + * + * @param connectorOffer the connectorOffer value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withConnectorOffer(connectorOffer); + return this; + } + + /** + * Get the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value. + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.innerProperties() == null ? null : this.innerProperties().disableKeyBasedMetadataWriteAccess(); + } + + /** + * Set the disableKeyBasedMetadataWriteAccess property: Disable write operations on metadata resources (databases, + * containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDisableKeyBasedMetadataWriteAccess( + Boolean disableKeyBasedMetadataWriteAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + return this; + } + + /** + * Get the keyVaultKeyUri property: The URI of the key vault. + * + * @return the keyVaultKeyUri value. + */ + public String keyVaultKeyUri() { + return this.innerProperties() == null ? null : this.innerProperties().keyVaultKeyUri(); + } + + /** + * Set the keyVaultKeyUri property: The URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withKeyVaultKeyUri(String keyVaultKeyUri) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withKeyVaultKeyUri(keyVaultKeyUri); + return this; + } + + /** + * Get the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @return the defaultIdentity value. + */ + public String defaultIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().defaultIdentity(); + } + + /** + * Set the defaultIdentity property: The default identity for accessing key vault used in features like customer + * managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", + * "SystemAssignedIdentity" and more. + * + * @param defaultIdentity the defaultIdentity value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDefaultIdentity(String defaultIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withDefaultIdentity(defaultIdentity); + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @return the enableFreeTier value. + */ + public Boolean enableFreeTier() { + return this.innerProperties() == null ? null : this.innerProperties().enableFreeTier(); + } + + /** + * Set the enableFreeTier property: Flag to indicate whether Free Tier is enabled. + * + * @param enableFreeTier the enableFreeTier value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableFreeTier(Boolean enableFreeTier) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableFreeTier(enableFreeTier); + return this; + } + + /** + * Get the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @return the apiProperties value. + */ + public ApiProperties apiProperties() { + return this.innerProperties() == null ? null : this.innerProperties().apiProperties(); + } + + /** + * Set the apiProperties property: API specific properties. Currently, supported only for MongoDB API. + * + * @param apiProperties the apiProperties value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withApiProperties(ApiProperties apiProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withApiProperties(apiProperties); + return this; + } + + /** + * Get the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @return the enableAnalyticalStorage value. + */ + public Boolean enableAnalyticalStorage() { + return this.innerProperties() == null ? null : this.innerProperties().enableAnalyticalStorage(); + } + + /** + * Set the enableAnalyticalStorage property: Flag to indicate whether to enable storage analytics. + * + * @param enableAnalyticalStorage the enableAnalyticalStorage value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableAnalyticalStorage(Boolean enableAnalyticalStorage) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withEnableAnalyticalStorage(enableAnalyticalStorage); + return this; + } + + /** + * Get the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @return the analyticalStorageConfiguration value. + */ + public AnalyticalStorageConfiguration analyticalStorageConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().analyticalStorageConfiguration(); + } + + /** + * Set the analyticalStorageConfiguration property: Analytical storage specific properties. + * + * @param analyticalStorageConfiguration the analyticalStorageConfiguration value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withAnalyticalStorageConfiguration( + AnalyticalStorageConfiguration analyticalStorageConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withAnalyticalStorageConfiguration(analyticalStorageConfiguration); + return this; + } + + /** + * Get the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().backupPolicy(); + } + + /** + * Set the backupPolicy property: The object representing the policy for taking backups on an account. + * + * @param backupPolicy the backupPolicy value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withBackupPolicy(BackupPolicy backupPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withBackupPolicy(backupPolicy); + return this; + } + + /** + * Get the cors property: The CORS policy for the Cosmos DB database account. + * + * @return the cors value. + */ + public List cors() { + return this.innerProperties() == null ? null : this.innerProperties().cors(); + } + + /** + * Set the cors property: The CORS policy for the Cosmos DB database account. + * + * @param cors the cors value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withCors(List cors) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withCors(cors); + return this; + } + + /** + * Get the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @return the networkAclBypass value. + */ + public NetworkAclBypass networkAclBypass() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypass(); + } + + /** + * Set the networkAclBypass property: Indicates what services are allowed to bypass firewall checks. + * + * @param networkAclBypass the networkAclBypass value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withNetworkAclBypass(NetworkAclBypass networkAclBypass) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withNetworkAclBypass(networkAclBypass); + return this; + } + + /** + * Get the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @return the networkAclBypassResourceIds value. + */ + public List networkAclBypassResourceIds() { + return this.innerProperties() == null ? null : this.innerProperties().networkAclBypassResourceIds(); + } + + /** + * Set the networkAclBypassResourceIds property: An array that contains the Resource Ids for Network Acl Bypass for + * the Cosmos DB account. + * + * @param networkAclBypassResourceIds the networkAclBypassResourceIds value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withNetworkAclBypassResourceIds(List networkAclBypassResourceIds) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withNetworkAclBypassResourceIds(networkAclBypassResourceIds); + return this; + } + + /** + * Get the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @return the diagnosticLogSettings value. + */ + public DiagnosticLogSettings diagnosticLogSettings() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticLogSettings(); + } + + /** + * Set the diagnosticLogSettings property: The Object representing the different Diagnostic log settings for the + * Cosmos DB Account. + * + * @param diagnosticLogSettings the diagnosticLogSettings value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDiagnosticLogSettings(DiagnosticLogSettings diagnosticLogSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withDiagnosticLogSettings(diagnosticLogSettings); + return this; + } + + /** + * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used + * exclusively for authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAccountUpdateProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java new file mode 100644 index 0000000000000..d7c1d93a09bd3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccounts.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAccounts. */ +public interface DatabaseAccounts { + /** + * Retrieves the properties of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + DatabaseAccountGetResults getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Retrieves the properties of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Deletes 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Deletes 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange(String resourceGroupName, String accountName, FailoverPolicies failoverParameters); + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failoverPriorityChange( + String resourceGroupName, String accountName, FailoverPolicies failoverParameters, Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + PagedIterable list(); + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + PagedIterable list(Context context); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the database accounts and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + DatabaseAccountListKeysResult listKeys(String resourceGroupName, String accountName); + + /** + * Lists the access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the given database account. + */ + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the connection strings for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + DatabaseAccountListConnectionStringsResult listConnectionStrings(String resourceGroupName, String accountName); + + /** + * Lists the connection strings for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection strings for the given database account. + */ + Response listConnectionStringsWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOffline); + + /** + * Offline the specified region for the specified 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 regionParameterForOffline Cosmos DB region to offline for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offlineRegion( + String resourceGroupName, + String accountName, + RegionForOnlineOffline regionParameterForOffline, + Context context); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion(String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline); + + /** + * Online the specified region for the specified 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 regionParameterForOnline Cosmos DB region to online for the database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void onlineRegion( + String resourceGroupName, String accountName, RegionForOnlineOffline regionParameterForOnline, Context context); + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult getReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response getReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Lists the read-only access keys for the specified 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + DatabaseAccountListReadOnlyKeysResult listReadOnlyKeys(String resourceGroupName, String accountName); + + /** + * Lists the read-only access keys for the specified 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the read-only access keys for the given database account. + */ + Response listReadOnlyKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey( + String resourceGroupName, String accountName, DatabaseAccountRegenerateKeyParameters keyToRegenerate); + + /** + * Regenerates an access key for the specified 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 keyToRegenerate The name of the key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateKey( + String resourceGroupName, + String accountName, + DatabaseAccountRegenerateKeyParameters keyToRegenerate, + Context context); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + boolean checkNameExists(String accountName); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase + * letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response checkNameExistsWithResponse(String accountName, Context context); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName, String filter, Context context); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves metric definitions for the given database account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + DatabaseAccountGetResults getById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB database account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseAccountGetResults resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseAccountGetResults definition. + */ + DatabaseAccountGetResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java new file mode 100644 index 0000000000000..eaf18046d8779 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseAccountGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the database accounts and their properties. */ +@Immutable +public final class DatabaseAccountsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseAccountsListResult.class); + + /* + * List of database account and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of database account and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java new file mode 100644 index 0000000000000..17bf2d3d28da2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DatabaseRestoreResource.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseRestoreResource. */ +public interface DatabaseRestoreResource { + /** + * Gets the databaseName property: The name of the database available for restore. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the collectionNames property: The names of the collections available for restore. + * + * @return the collectionNames value. + */ + List collectionNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner object. + * + * @return the inner object. + */ + DatabaseRestoreResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java new file mode 100644 index 0000000000000..8b1498eec6cba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Databases.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Databases. */ +public interface Databases { + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String databaseRid, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages(String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list usage request. + */ + PagedIterable listUsages( + String resourceGroupName, String accountName, String databaseRid, String filter, Context context); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves metric definitions for the given database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list metric definitions request. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String accountName, String databaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java new file mode 100644 index 0000000000000..5833121835c24 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DefaultConsistencyLevel.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DefaultConsistencyLevel. */ +public enum DefaultConsistencyLevel { + /** Enum value Eventual. */ + EVENTUAL("Eventual"), + + /** Enum value Session. */ + SESSION("Session"), + + /** Enum value BoundedStaleness. */ + BOUNDED_STALENESS("BoundedStaleness"), + + /** Enum value Strong. */ + STRONG("Strong"), + + /** Enum value ConsistentPrefix. */ + CONSISTENT_PREFIX("ConsistentPrefix"); + + /** The actual serialized value for a DefaultConsistencyLevel instance. */ + private final String value; + + DefaultConsistencyLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DefaultConsistencyLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed DefaultConsistencyLevel object, or null if unable to parse. + */ + @JsonCreator + public static DefaultConsistencyLevel fromString(String value) { + DefaultConsistencyLevel[] items = DefaultConsistencyLevel.values(); + for (DefaultConsistencyLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DiagnosticLogSettings.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DiagnosticLogSettings.java new file mode 100644 index 0000000000000..a9eab2568be23 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/DiagnosticLogSettings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Indicates what diagnostic log settings are to be enabled. */ +@Fluent +public final class DiagnosticLogSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticLogSettings.class); + + /* + * Describe the level of detail with which queries are to be logged. + */ + @JsonProperty(value = "enableFullTextQuery") + private EnableFullTextQuery enableFullTextQuery; + + /** + * Get the enableFullTextQuery property: Describe the level of detail with which queries are to be logged. + * + * @return the enableFullTextQuery value. + */ + public EnableFullTextQuery enableFullTextQuery() { + return this.enableFullTextQuery; + } + + /** + * Set the enableFullTextQuery property: Describe the level of detail with which queries are to be logged. + * + * @param enableFullTextQuery the enableFullTextQuery value to set. + * @return the DiagnosticLogSettings object itself. + */ + public DiagnosticLogSettings withEnableFullTextQuery(EnableFullTextQuery enableFullTextQuery) { + this.enableFullTextQuery = enableFullTextQuery; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/EnableFullTextQuery.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/EnableFullTextQuery.java new file mode 100644 index 0000000000000..73aa5b312c76f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/EnableFullTextQuery.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for EnableFullTextQuery. */ +public enum EnableFullTextQuery { + /** Enum value None. */ + NONE("None"), + + /** Enum value True. */ + TRUE("True"), + + /** Enum value False. */ + FALSE("False"); + + /** The actual serialized value for a EnableFullTextQuery instance. */ + private final String value; + + EnableFullTextQuery(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnableFullTextQuery instance. + * + * @param value the serialized value to parse. + * @return the parsed EnableFullTextQuery object, or null if unable to parse. + */ + @JsonCreator + public static EnableFullTextQuery fromString(String value) { + EnableFullTextQuery[] items = EnableFullTextQuery.values(); + for (EnableFullTextQuery item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java new file mode 100644 index 0000000000000..d4747945ccf6b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExcludedPath.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ExcludedPath model. */ +@Fluent +public final class ExcludedPath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExcludedPath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the ExcludedPath object itself. + */ + public ExcludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java new file mode 100644 index 0000000000000..409395f8e7084 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ExtendedResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin + * graphs. + */ +@Immutable +public class ExtendedResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedResourceProperties.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java new file mode 100644 index 0000000000000..72622c65097cd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicies.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of new failover policies for the failover priority change. */ +@Fluent +public final class FailoverPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverPolicies.class); + + /* + * List of failover policies. + */ + @JsonProperty(value = "failoverPolicies", required = true) + private List failoverPolicies; + + /** + * Get the failoverPolicies property: List of failover policies. + * + * @return the failoverPolicies value. + */ + public List failoverPolicies() { + return this.failoverPolicies; + } + + /** + * Set the failoverPolicies property: List of failover policies. + * + * @param failoverPolicies the failoverPolicies value to set. + * @return the FailoverPolicies object itself. + */ + public FailoverPolicies withFailoverPolicies(List failoverPolicies) { + this.failoverPolicies = failoverPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicies() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicies in model FailoverPolicies")); + } else { + failoverPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java new file mode 100644 index 0000000000000..14b13c012d9ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/FailoverPolicy.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The failover policy for a given region of a database account. */ +@Fluent +public final class FailoverPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FailoverPolicy.class); + + /* + * The unique identifier of the region in which the database account + * replicates to. Example: <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region in which the database account exists. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** + * Get the id property: The unique identifier of the region in which the database account replicates to. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the locationName property: The name of the region in which the database account exists. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the locationName property: The name of the region in which the database account exists. + * + * @param locationName the locationName value to set. + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value. + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set. + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeRegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeRegionalServiceResource.java new file mode 100644 index 0000000000000..6fb8e39511db6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeRegionalServiceResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public final class GraphApiComputeRegionalServiceResource extends RegionalServiceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphApiComputeRegionalServiceResource.class); + + /* + * The regional endpoint for GraphAPICompute. + */ + @JsonProperty(value = "graphApiComputeEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String graphApiComputeEndpoint; + + /** + * Get the graphApiComputeEndpoint property: The regional endpoint for GraphAPICompute. + * + * @return the graphApiComputeEndpoint value. + */ + public String graphApiComputeEndpoint() { + return this.graphApiComputeEndpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java new file mode 100644 index 0000000000000..e8aeaedc173c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphApiComputeServiceResourceProperties.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for GraphAPIComputeServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("GraphAPICompute") +@Fluent +public final class GraphApiComputeServiceResourceProperties extends ServiceResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphApiComputeServiceResourceProperties.class); + + /* + * GraphAPICompute endpoint for the service. + */ + @JsonProperty(value = "graphApiComputeEndpoint") + private String graphApiComputeEndpoint; + + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * Get the graphApiComputeEndpoint property: GraphAPICompute endpoint for the service. + * + * @return the graphApiComputeEndpoint value. + */ + public String graphApiComputeEndpoint() { + return this.graphApiComputeEndpoint; + } + + /** + * Set the graphApiComputeEndpoint property: GraphAPICompute endpoint for the service. + * + * @param graphApiComputeEndpoint the graphApiComputeEndpoint value to set. + * @return the GraphApiComputeServiceResourceProperties object itself. + */ + public GraphApiComputeServiceResourceProperties withGraphApiComputeEndpoint(String graphApiComputeEndpoint) { + this.graphApiComputeEndpoint = graphApiComputeEndpoint; + return this; + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public GraphApiComputeServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphApiComputeServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResource.java new file mode 100644 index 0000000000000..a039c73adf163 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Graph resource object. */ +@Fluent +public class GraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResource.class); + + /* + * Name of the Cosmos DB Graph + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB Graph. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Graph. + * + * @param id the id value to set. + * @return the GraphResource object itself. + */ + public GraphResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GraphResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceCreateUpdateParameters.java new file mode 100644 index 0000000000000..0322413b38a6a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Graph resource. */ +@Fluent +public final class GraphResourceCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Graph resource. + */ + @JsonProperty(value = "properties", required = true) + private GraphResourceCreateUpdateProperties innerProperties = new GraphResourceCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Graph resource. + * + * @return the innerProperties value. + */ + private GraphResourceCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Graph resource. + * + * @return the resource value. + */ + public GraphResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Graph resource. + * + * @param resource the resource value to set. + * @return the GraphResourceCreateUpdateParameters object itself. + */ + public GraphResourceCreateUpdateParameters withResource(GraphResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GraphResourceCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GraphResourceCreateUpdateParameters object itself. + */ + public GraphResourceCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GraphResourceCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GraphResourceCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesOptions.java new file mode 100644 index 0000000000000..84395b504d5df --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GraphResourceGetPropertiesOptions model. */ +@Fluent +public final class GraphResourceGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public GraphResourceGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesResource.java new file mode 100644 index 0000000000000..634e32d46c0bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GraphResourceGetPropertiesResource model. */ +@Fluent +public final class GraphResourceGetPropertiesResource extends GraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourceGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public GraphResourceGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetResults.java new file mode 100644 index 0000000000000..5b99b09e61b71 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourceGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of GraphResourceGetResults. */ +public interface GraphResourceGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + GraphResourceGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + GraphResourceGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner object. + * + * @return the inner object. + */ + GraphResourceGetResultsInner innerModel(); + + /** The entirety of the GraphResourceGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The GraphResourceGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the GraphResourceGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GraphResourceGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GraphResourceGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the GraphResourceGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Graph resource. + * + * @param resource The standard JSON format of a Graph resource. + * @return the next definition stage. + */ + WithCreate withResource(GraphResource resource); + } + /** + * The stage of the GraphResourceGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + GraphResourceGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GraphResourceGetResults create(Context context); + } + /** The stage of the GraphResourceGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the GraphResourceGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GraphResourceGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the GraphResourceGetResults resource. + * + * @return the stage of resource update. + */ + GraphResourceGetResults.Update update(); + + /** The template for GraphResourceGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GraphResourceGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GraphResourceGetResults apply(Context context); + } + /** The GraphResourceGetResults update stages. */ + interface UpdateStages { + /** The stage of the GraphResourceGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the GraphResourceGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GraphResourceGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Graph resource. + * + * @param resource The standard JSON format of a Graph resource. + * @return the next definition stage. + */ + Update withResource(GraphResource resource); + } + /** The stage of the GraphResourceGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GraphResourceGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GraphResourceGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResources.java new file mode 100644 index 0000000000000..6321f25d629bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResources.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of GraphResources. */ +public interface GraphResources { + /** + * Lists the graphs 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + PagedIterable listGraphs(String resourceGroupName, String accountName); + + /** + * Lists the graphs 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Graph resource and their properties. + */ + PagedIterable listGraphs(String resourceGroupName, String accountName, Context context); + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + GraphResourceGetResults getGraph(String resourceGroupName, String accountName, String graphName); + + /** + * Gets the Graph resource 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 graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGraphWithResponse( + String resourceGroupName, String accountName, String graphName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGraphResource(String resourceGroupName, String accountName, String graphName); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param graphName Cosmos DB graph resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGraphResource(String resourceGroupName, String accountName, String graphName, Context context); + + /** + * Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + GraphResourceGetResults getGraphById(String id); + + /** + * Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Graph resource under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGraphByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGraphResourceById(String id); + + /** + * Deletes an existing Azure Cosmos DB Graph Resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGraphResourceByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GraphResourceGetResults resource. + * + * @param name resource name. + * @return the first stage of the new GraphResourceGetResults definition. + */ + GraphResourceGetResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourcesListResult.java new file mode 100644 index 0000000000000..31a24c4e53502 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GraphResourcesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GraphResourceGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Graph resource and their properties. */ +@Immutable +public final class GraphResourcesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GraphResourcesListResult.class); + + /* + * List of Graph resource and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Graph resource and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..4e029078f042c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Gremlin database. */ +@Fluent +public final class GremlinDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Gremlin database. + */ + @JsonProperty(value = "properties", required = true) + private GremlinDatabaseCreateUpdateProperties innerProperties = new GremlinDatabaseCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Gremlin database. + * + * @return the innerProperties value. + */ + private GremlinDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Gremlin database. + * + * @return the resource value. + */ + public GremlinDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Gremlin database. + * + * @param resource the resource value to set. + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withResource(GremlinDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GremlinDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..b3994f15c3688 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinDatabaseGetPropertiesOptions model. */ +@Fluent +public final class GremlinDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..1c7488b173aa3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinDatabaseGetPropertiesResource model. */ +@Fluent +public final class GremlinDatabaseGetPropertiesResource extends GremlinDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public GremlinDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java new file mode 100644 index 0000000000000..9e2e0d9592f13 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of GremlinDatabaseGetResults. */ +public interface GremlinDatabaseGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + GremlinDatabaseGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + GremlinDatabaseGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner object. + * + * @return the inner object. + */ + GremlinDatabaseGetResultsInner innerModel(); + + /** The entirety of the GremlinDatabaseGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The GremlinDatabaseGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the GremlinDatabaseGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Gremlin database. + * + * @param resource The standard JSON format of a Gremlin database. + * @return the next definition stage. + */ + WithCreate withResource(GremlinDatabaseResource resource); + } + /** + * The stage of the GremlinDatabaseGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + GremlinDatabaseGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GremlinDatabaseGetResults create(Context context); + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GremlinDatabaseGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the GremlinDatabaseGetResults resource. + * + * @return the stage of resource update. + */ + GremlinDatabaseGetResults.Update update(); + + /** The template for GremlinDatabaseGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GremlinDatabaseGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GremlinDatabaseGetResults apply(Context context); + } + /** The GremlinDatabaseGetResults update stages. */ + interface UpdateStages { + /** The stage of the GremlinDatabaseGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the GremlinDatabaseGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GremlinDatabaseGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Gremlin database. + * + * @param resource The standard JSON format of a Gremlin database. + * @return the next definition stage. + */ + Update withResource(GremlinDatabaseResource resource); + } + /** The stage of the GremlinDatabaseGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GremlinDatabaseGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GremlinDatabaseGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.java new file mode 100644 index 0000000000000..c98cd6bca1d55 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Gremlin databases and their properties. */ +@Immutable +public final class GremlinDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseListResult.class); + + /* + * List of Gremlin databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Gremlin databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java new file mode 100644 index 0000000000000..00f603653e03c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin database resource object. */ +@Fluent +public class GremlinDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinDatabaseResource.class); + + /* + * Name of the Cosmos DB Gremlin database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB Gremlin database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Gremlin database. + * + * @param id the id value to set. + * @return the GremlinDatabaseResource object itself. + */ + public GremlinDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java new file mode 100644 index 0000000000000..b97e92a512ded --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Gremlin graph. */ +@Fluent +public final class GremlinGraphCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Gremlin graph. + */ + @JsonProperty(value = "properties", required = true) + private GremlinGraphCreateUpdateProperties innerProperties = new GremlinGraphCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Gremlin graph. + * + * @return the innerProperties value. + */ + private GremlinGraphCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Gremlin graph. + * + * @return the resource value. + */ + public GremlinGraphResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource the resource value to set. + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withResource(GremlinGraphResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new GremlinGraphCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GremlinGraphCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java new file mode 100644 index 0000000000000..5afc35c897655 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The GremlinGraphGetPropertiesOptions model. */ +@Fluent +public final class GremlinGraphGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java new file mode 100644 index 0000000000000..22226ddcc6681 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetPropertiesResource.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GremlinGraphGetPropertiesResource model. */ +@Fluent +public final class GremlinGraphGetPropertiesResource extends GremlinGraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public GremlinGraphGetPropertiesResource withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java new file mode 100644 index 0000000000000..580447b123454 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphGetResults.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of GremlinGraphGetResults. */ +public interface GremlinGraphGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + GremlinGraphGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + GremlinGraphGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner object. + * + * @return the inner object. + */ + GremlinGraphGetResultsInner innerModel(); + + /** The entirety of the GremlinGraphGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The GremlinGraphGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the GremlinGraphGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GremlinGraphGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GremlinGraphGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + } + /** The stage of the GremlinGraphGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource The standard JSON format of a Gremlin graph. + * @return the next definition stage. + */ + WithCreate withResource(GremlinGraphResource resource); + } + /** + * The stage of the GremlinGraphGetResults definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + GremlinGraphGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GremlinGraphGetResults create(Context context); + } + /** The stage of the GremlinGraphGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the GremlinGraphGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GremlinGraphGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the GremlinGraphGetResults resource. + * + * @return the stage of resource update. + */ + GremlinGraphGetResults.Update update(); + + /** The template for GremlinGraphGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GremlinGraphGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GremlinGraphGetResults apply(Context context); + } + /** The GremlinGraphGetResults update stages. */ + interface UpdateStages { + /** The stage of the GremlinGraphGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the GremlinGraphGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the GremlinGraphGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Gremlin graph. + * + * @param resource The standard JSON format of a Gremlin graph. + * @return the next definition stage. + */ + Update withResource(GremlinGraphResource resource); + } + /** The stage of the GremlinGraphGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GremlinGraphGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GremlinGraphGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java new file mode 100644 index 0000000000000..90fc765ce1d6a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.GremlinGraphGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the graphs and their properties. */ +@Immutable +public final class GremlinGraphListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphListResult.class); + + /* + * List of graphs and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of graphs and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java new file mode 100644 index 0000000000000..b10d826f714c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinGraphResource.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB Gremlin graph resource object. */ +@Fluent +public class GremlinGraphResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GremlinGraphResource.class); + + /* + * Name of the Cosmos DB Gremlin graph + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the graph + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data + * into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the graph. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * Get the id property: Name of the Cosmos DB Gremlin graph. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB Gremlin graph. + * + * @param id the id value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the graph. + * + * @return the indexingPolicy value. + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the graph. + * + * @param indexingPolicy the indexingPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @return the partitionKey value. + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @param partitionKey the partitionKey value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get the defaultTtl property: Default time to live. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Default time to live. + * + * @param defaultTtl the defaultTtl value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value. + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflictResolutionPolicy property: The conflict resolution policy for the graph. + * + * @return the conflictResolutionPolicy value. + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: The conflict resolution policy for the graph. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model GremlinGraphResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java new file mode 100644 index 0000000000000..4f9bfa7e08a4b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/GremlinResources.java @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of GremlinResources. */ +public interface GremlinResources { + /** + * Lists the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + PagedIterable listGremlinDatabases(String resourceGroupName, String accountName); + + /** + * Lists the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Gremlin databases and their properties. + */ + PagedIterable listGremlinDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the Gremlin databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + GremlinDatabaseGetResults getGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the Gremlin databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the Gremlin database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getGremlinDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the Gremlin database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getGremlinDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the graphs and their properties. + */ + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the graphs and their properties. + */ + PagedIterable listGremlinGraphs( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + GremlinGraphGetResults getGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + Response getGremlinGraphWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraph( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + ThroughputSettingsGetResults getGremlinGraphThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinGraphThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateGremlinGraphThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String graphName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToAutoscale( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateGremlinGraphToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String graphName, Context context); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + GremlinDatabaseGetResults getGremlinDatabaseById(String id); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getGremlinDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + GremlinGraphGetResults getGremlinGraphById(String id); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Gremlin graph under an existing Azure Cosmos DB database account. + */ + Response getGremlinGraphByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraphById(String id); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteGremlinGraphByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GremlinDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new GremlinDatabaseGetResults definition. + */ + GremlinDatabaseGetResults.DefinitionStages.Blank defineUpdateGremlinDatabase(String name); + + /** + * Begins definition for a new GremlinGraphGetResults resource. + * + * @param name resource name. + * @return the first stage of the new GremlinGraphGetResults definition. + */ + GremlinGraphGetResults.DefinitionStages.Blank defineUpdateGremlinGraph(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java new file mode 100644 index 0000000000000..0a1cef49d2714 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IncludedPath.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paths that are included in indexing. */ +@Fluent +public final class IncludedPath { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IncludedPath.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of indexes for this path + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the IncludedPath object itself. + */ + public IncludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the indexes property: List of indexes for this path. + * + * @return the indexes value. + */ + public List indexes() { + return this.indexes; + } + + /** + * Set the indexes property: List of indexes for this path. + * + * @param indexes the indexes value to set. + * @return the IncludedPath object itself. + */ + public IncludedPath withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java new file mode 100644 index 0000000000000..1afa6d536ed9b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IndexKind. */ +public final class IndexKind extends ExpandableStringEnum { + /** Static value Hash for IndexKind. */ + public static final IndexKind HASH = fromString("Hash"); + + /** Static value Range for IndexKind. */ + public static final IndexKind RANGE = fromString("Range"); + + /** Static value Spatial for IndexKind. */ + public static final IndexKind SPATIAL = fromString("Spatial"); + + /** + * Creates or finds a IndexKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexKind. + */ + @JsonCreator + public static IndexKind fromString(String name) { + return fromString(name, IndexKind.class); + } + + /** @return known IndexKind values. */ + public static Collection values() { + return values(IndexKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java new file mode 100644 index 0000000000000..ab9487fb08798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Indexes.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The indexes for the path. */ +@Fluent +public final class Indexes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Indexes.class); + + /* + * The datatype for which the indexing behavior is applied to. + */ + @JsonProperty(value = "dataType") + private DataType dataType; + + /* + * The precision of the index. -1 is maximum precision. + */ + @JsonProperty(value = "precision") + private Integer precision; + + /* + * Indicates the type of index. + */ + @JsonProperty(value = "kind") + private IndexKind kind; + + /** + * Get the dataType property: The datatype for which the indexing behavior is applied to. + * + * @return the dataType value. + */ + public DataType dataType() { + return this.dataType; + } + + /** + * Set the dataType property: The datatype for which the indexing behavior is applied to. + * + * @param dataType the dataType value to set. + * @return the Indexes object itself. + */ + public Indexes withDataType(DataType dataType) { + this.dataType = dataType; + return this; + } + + /** + * Get the precision property: The precision of the index. -1 is maximum precision. + * + * @return the precision value. + */ + public Integer precision() { + return this.precision; + } + + /** + * Set the precision property: The precision of the index. -1 is maximum precision. + * + * @param precision the precision value to set. + * @return the Indexes object itself. + */ + public Indexes withPrecision(Integer precision) { + this.precision = precision; + return this; + } + + /** + * Get the kind property: Indicates the type of index. + * + * @return the kind value. + */ + public IndexKind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the type of index. + * + * @param kind the kind value to set. + * @return the Indexes object itself. + */ + public Indexes withKind(IndexKind kind) { + this.kind = kind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java new file mode 100644 index 0000000000000..d44c1e8411b82 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IndexingMode. */ +public final class IndexingMode extends ExpandableStringEnum { + /** Static value consistent for IndexingMode. */ + public static final IndexingMode CONSISTENT = fromString("consistent"); + + /** Static value lazy for IndexingMode. */ + public static final IndexingMode LAZY = fromString("lazy"); + + /** Static value none for IndexingMode. */ + public static final IndexingMode NONE = fromString("none"); + + /** + * Creates or finds a IndexingMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingMode. + */ + @JsonCreator + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** @return known IndexingMode values. */ + public static Collection values() { + return values(IndexingMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java new file mode 100644 index 0000000000000..b624e9483ac87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IndexingPolicy.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB indexing policy. */ +@Fluent +public final class IndexingPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IndexingPolicy.class); + + /* + * Indicates if the indexing policy is automatic + */ + @JsonProperty(value = "automatic") + private Boolean automatic; + + /* + * Indicates the indexing mode. + */ + @JsonProperty(value = "indexingMode") + private IndexingMode indexingMode; + + /* + * List of paths to include in the indexing + */ + @JsonProperty(value = "includedPaths") + private List includedPaths; + + /* + * List of paths to exclude from indexing + */ + @JsonProperty(value = "excludedPaths") + private List excludedPaths; + + /* + * List of composite path list + */ + @JsonProperty(value = "compositeIndexes") + private List> compositeIndexes; + + /* + * List of spatial specifics + */ + @JsonProperty(value = "spatialIndexes") + private List spatialIndexes; + + /** + * Get the automatic property: Indicates if the indexing policy is automatic. + * + * @return the automatic value. + */ + public Boolean automatic() { + return this.automatic; + } + + /** + * Set the automatic property: Indicates if the indexing policy is automatic. + * + * @param automatic the automatic value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withAutomatic(Boolean automatic) { + this.automatic = automatic; + return this; + } + + /** + * Get the indexingMode property: Indicates the indexing mode. + * + * @return the indexingMode value. + */ + public IndexingMode indexingMode() { + return this.indexingMode; + } + + /** + * Set the indexingMode property: Indicates the indexing mode. + * + * @param indexingMode the indexingMode value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIndexingMode(IndexingMode indexingMode) { + this.indexingMode = indexingMode; + return this; + } + + /** + * Get the includedPaths property: List of paths to include in the indexing. + * + * @return the includedPaths value. + */ + public List includedPaths() { + return this.includedPaths; + } + + /** + * Set the includedPaths property: List of paths to include in the indexing. + * + * @param includedPaths the includedPaths value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIncludedPaths(List includedPaths) { + this.includedPaths = includedPaths; + return this; + } + + /** + * Get the excludedPaths property: List of paths to exclude from indexing. + * + * @return the excludedPaths value. + */ + public List excludedPaths() { + return this.excludedPaths; + } + + /** + * Set the excludedPaths property: List of paths to exclude from indexing. + * + * @param excludedPaths the excludedPaths value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withExcludedPaths(List excludedPaths) { + this.excludedPaths = excludedPaths; + return this; + } + + /** + * Get the compositeIndexes property: List of composite path list. + * + * @return the compositeIndexes value. + */ + public List> compositeIndexes() { + return this.compositeIndexes; + } + + /** + * Set the compositeIndexes property: List of composite path list. + * + * @param compositeIndexes the compositeIndexes value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withCompositeIndexes(List> compositeIndexes) { + this.compositeIndexes = compositeIndexes; + return this; + } + + /** + * Get the spatialIndexes property: List of spatial specifics. + * + * @return the spatialIndexes value. + */ + public List spatialIndexes() { + return this.spatialIndexes; + } + + /** + * Set the spatialIndexes property: List of spatial specifics. + * + * @param spatialIndexes the spatialIndexes value to set. + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withSpatialIndexes(List spatialIndexes) { + this.spatialIndexes = spatialIndexes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (includedPaths() != null) { + includedPaths().forEach(e -> e.validate()); + } + if (excludedPaths() != null) { + excludedPaths().forEach(e -> e.validate()); + } + if (compositeIndexes() != null) { + compositeIndexes().forEach(e -> e.forEach(e1 -> e1.validate())); + } + if (spatialIndexes() != null) { + spatialIndexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java new file mode 100644 index 0000000000000..a198c40250068 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/IpAddressOrRange.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IpAddressOrRange object. */ +@Fluent +public final class IpAddressOrRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpAddressOrRange.class); + + /* + * A single IPv4 address or a single IPv4 address range in CIDR format. + * Provided IPs must be well-formatted and cannot be contained in one of + * the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, + * 192.168.0.0/16, since these are not enforceable by the IP address + * filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + */ + @JsonProperty(value = "ipAddressOrRange") + private String ipAddressOrRange; + + /** + * Get the ipAddressOrRange property: A single IPv4 address or a single IPv4 address range in CIDR format. Provided + * IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, + * 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: + * “23.40.210.245” or “23.40.210.0/8”. + * + * @return the ipAddressOrRange value. + */ + public String ipAddressOrRange() { + return this.ipAddressOrRange; + } + + /** + * Set the ipAddressOrRange property: A single IPv4 address or a single IPv4 address range in CIDR format. Provided + * IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, + * 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: + * “23.40.210.245” or “23.40.210.0/8”. + * + * @param ipAddressOrRange the ipAddressOrRange value to set. + * @return the IpAddressOrRange object itself. + */ + public IpAddressOrRange withIpAddressOrRange(String ipAddressOrRange) { + this.ipAddressOrRange = ipAddressOrRange; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java new file mode 100644 index 0000000000000..a87dfaf433756 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/KeyKind.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KeyKind. */ +public final class KeyKind extends ExpandableStringEnum { + /** Static value primary for KeyKind. */ + public static final KeyKind PRIMARY = fromString("primary"); + + /** Static value secondary for KeyKind. */ + public static final KeyKind SECONDARY = fromString("secondary"); + + /** Static value primaryReadonly for KeyKind. */ + public static final KeyKind PRIMARY_READONLY = fromString("primaryReadonly"); + + /** Static value secondaryReadonly for KeyKind. */ + public static final KeyKind SECONDARY_READONLY = fromString("secondaryReadonly"); + + /** + * Creates or finds a KeyKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyKind. + */ + @JsonCreator + public static KeyKind fromString(String name) { + return fromString(name, KeyKind.class); + } + + /** @return known KeyKind values. */ + public static Collection values() { + return values(KeyKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListBackups.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListBackups.java new file mode 100644 index 0000000000000..49823df0b8c08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListBackups.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.BackupResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of restorable backups for a Cassandra cluster. */ +@Immutable +public final class ListBackups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListBackups.class); + + /* + * Container for array of backups. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: Container for array of backups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListClusters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListClusters.java new file mode 100644 index 0000000000000..ec8ed3c798c4c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListClusters.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ClusterResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed Cassandra clusters. */ +@Fluent +public final class ListClusters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListClusters.class); + + /* + * Container for the array of clusters. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Container for the array of clusters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Container for the array of clusters. + * + * @param value the value value to set. + * @return the ListClusters object itself. + */ + public ListClusters withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListDataCenters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListDataCenters.java new file mode 100644 index 0000000000000..97e291434cb26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ListDataCenters.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DataCenterResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed Cassandra data centers and their properties. */ +@Immutable +public final class ListDataCenters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListDataCenters.class); + + /* + * Container for array of data centers. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: Container for array of data centers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java new file mode 100644 index 0000000000000..03c9c6ee9a99a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Location.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A region in which the Azure Cosmos DB database account is deployed. */ +@Fluent +public final class Location { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Location.class); + + /* + * The unique identifier of the region within the database account. + * Example: <accountName>-<locationName>. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the region. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /* + * The connection endpoint for the specific region. Example: + * https://<accountName>-<locationName>.documents.azure.com:443/ + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /* + * The status of the Cosmos DB account at the time the operation was + * called. The status can be one of following. 'Creating' – the Cosmos DB + * account is being created. When an account is in Creating state, only + * properties that are specified as input for the Create Cosmos DB account + * operation are returned. 'Succeeded' – the Cosmos DB account is active + * for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' + * – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB + * account failed creation. 'DeletionFailed' – the Cosmos DB account + * deletion failed. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /* + * Flag to indicate whether or not this region is an AvailabilityZone + * region + */ + @JsonProperty(value = "isZoneRedundant") + private Boolean isZoneRedundant; + + /** + * Get the id property: The unique identifier of the region within the database account. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the locationName property: The name of the region. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the locationName property: The name of the region. + * + * @param locationName the locationName value to set. + * @return the Location object itself. + */ + public Location withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the documentEndpoint property: The connection endpoint for the specific region. Example: + * https://&lt;accountName&gt;-&lt;locationName&gt;.documents.azure.com:443/. + * + * @return the documentEndpoint value. + */ + public String documentEndpoint() { + return this.documentEndpoint; + } + + /** + * Get the provisioningState property: The status of the Cosmos DB account at the time the operation was called. The + * status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in + * Creating state, only properties that are specified as input for the Create Cosmos DB account operation are + * returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being + * updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. + * 'DeletionFailed' – the Cosmos DB account deletion failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value. + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failoverPriority property: The failover priority of the region. A failover priority of 0 indicates a + * write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values + * must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set. + * @return the Location object itself. + */ + public Location withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + + /** + * Get the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region. + * + * @return the isZoneRedundant value. + */ + public Boolean isZoneRedundant() { + return this.isZoneRedundant; + } + + /** + * Set the isZoneRedundant property: Flag to indicate whether or not this region is an AvailabilityZone region. + * + * @param isZoneRedundant the isZoneRedundant value to set. + * @return the Location object itself. + */ + public Location withIsZoneRedundant(Boolean isZoneRedundant) { + this.isZoneRedundant = isZoneRedundant; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java new file mode 100644 index 0000000000000..ac430bd7d70f8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationGetResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; + +/** An immutable client-side representation of LocationGetResult. */ +public interface LocationGetResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Cosmos DB location metadata. + * + * @return the properties value. + */ + LocationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner object. + * + * @return the inner object. + */ + LocationGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java new file mode 100644 index 0000000000000..195f44aeeb5ba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.LocationGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains Cosmos DB locations and their properties. */ +@Immutable +public final class LocationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationListResult.class); + + /* + * List of Cosmos DB locations and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Cosmos DB locations and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationProperties.java new file mode 100644 index 0000000000000..3d14fe4c8c7ba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/LocationProperties.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB location metadata. */ +@Immutable +public final class LocationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationProperties.class); + + /* + * The current status of location in Azure. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Flag indicating whether the location supports availability zones or not. + */ + @JsonProperty(value = "supportsAvailabilityZone", access = JsonProperty.Access.WRITE_ONLY) + private Boolean supportsAvailabilityZone; + + /* + * Flag indicating whether the location is residency sensitive. + */ + @JsonProperty(value = "isResidencyRestricted", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isResidencyRestricted; + + /* + * The properties of available backup storage redundancies. + */ + @JsonProperty(value = "backupStorageRedundancies", access = JsonProperty.Access.WRITE_ONLY) + private List backupStorageRedundancies; + + /** + * Get the status property: The current status of location in Azure. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the supportsAvailabilityZone property: Flag indicating whether the location supports availability zones or + * not. + * + * @return the supportsAvailabilityZone value. + */ + public Boolean supportsAvailabilityZone() { + return this.supportsAvailabilityZone; + } + + /** + * Get the isResidencyRestricted property: Flag indicating whether the location is residency sensitive. + * + * @return the isResidencyRestricted value. + */ + public Boolean isResidencyRestricted() { + return this.isResidencyRestricted; + } + + /** + * Get the backupStorageRedundancies property: The properties of available backup storage redundancies. + * + * @return the backupStorageRedundancies value. + */ + public List backupStorageRedundancies() { + return this.backupStorageRedundancies; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraProvisioningState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraProvisioningState.java new file mode 100644 index 0000000000000..4146b2fc1bcfb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedCassandraProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedCassandraProvisioningState. */ +public final class ManagedCassandraProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ManagedCassandraProvisioningState. */ + public static final ManagedCassandraProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ManagedCassandraProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedCassandraProvisioningState. + */ + @JsonCreator + public static ManagedCassandraProvisioningState fromString(String name) { + return fromString(name, ManagedCassandraProvisioningState.class); + } + + /** @return known ManagedCassandraProvisioningState values. */ + public static Collection values() { + return values(ManagedCassandraProvisioningState.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..0b50ab420d018 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentity.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the resource. */ +@Fluent +public class ManagedServiceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServiceIdentity.class); + + /* + * The principal id of the system assigned identity. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the resource. The type + * 'SystemAssigned,UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the service. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal id of the system assigned identity. This property will only be + * provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..2ce1e876565be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ManagedServiceIdentityUserAssignedIdentities.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedServiceIdentityUserAssignedIdentities model. */ +@Immutable +public final class ManagedServiceIdentityUserAssignedIdentities { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ManagedServiceIdentityUserAssignedIdentities.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java new file mode 100644 index 0000000000000..8720c9fe2f2b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Metric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..457e3d6ac36e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricAvailability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The availability of the metric. */ +@Immutable +public final class MetricAvailability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAvailability.class); + + /* + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The retention for the metric values. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * Get the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the retention property: The retention for the metric values. + * + * @return the retention value. + */ + public String retention() { + return this.retention; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..4ca7c84770599 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the metricAvailabilities property: The list of metric availabilities for the account. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the primaryAggregationType property: The primary aggregation type of the metric. + * + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java new file mode 100644 index 0000000000000..493f009fb5ce4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricDefinitionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metric definitions request. */ +@Immutable +public final class MetricDefinitionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionsListResult.class); + + /* + * The list of metric definitions for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of metric definitions for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java new file mode 100644 index 0000000000000..6162dabcc0995 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list metrics request. */ +@Immutable +public final class MetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricListResult.class); + + /* + * The list of metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java new file mode 100644 index 0000000000000..42a6ff98e7086 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricName.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A metric name. */ +@Immutable +public final class MetricName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricName.class); + + /* + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value property: The name of the metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The friendly name of the metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java new file mode 100644 index 0000000000000..dc6da4d548e3f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MetricValue.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents metrics values. */ +@Immutable +public class MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricValue.class); + + /* + * The number of values for the metric. + */ + @JsonProperty(value = "_count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /* + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /* + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /* + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java new file mode 100644 index 0000000000000..94ed723439b5c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB MongoDB collection. */ +@Fluent +public final class MongoDBCollectionCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB MongoDB collection. + */ + @JsonProperty(value = "properties", required = true) + private MongoDBCollectionCreateUpdateProperties innerProperties = new MongoDBCollectionCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB MongoDB collection. + * + * @return the innerProperties value. + */ + private MongoDBCollectionCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a MongoDB collection. + * + * @return the resource value. + */ + public MongoDBCollectionResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource the resource value to set. + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withResource(MongoDBCollectionResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBCollectionCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBCollectionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java new file mode 100644 index 0000000000000..49cdc089d444a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBCollectionGetPropertiesOptions model. */ +@Fluent +public final class MongoDBCollectionGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java new file mode 100644 index 0000000000000..3b3c5f16272e7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetPropertiesResource.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The MongoDBCollectionGetPropertiesResource model. */ +@Fluent +public final class MongoDBCollectionGetPropertiesResource extends MongoDBCollectionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withShardKey(Map shardKey) { + super.withShardKey(shardKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withIndexes(List indexes) { + super.withIndexes(indexes); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBCollectionGetPropertiesResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java new file mode 100644 index 0000000000000..a4b8219b46a40 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionGetResults.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of MongoDBCollectionGetResults. */ +public interface MongoDBCollectionGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + MongoDBCollectionGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + MongoDBCollectionGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner object. + * + * @return the inner object. + */ + MongoDBCollectionGetResultsInner innerModel(); + + /** The entirety of the MongoDBCollectionGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The MongoDBCollectionGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the MongoDBCollectionGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingMongodbDatabase(String resourceGroupName, String accountName, String databaseName); + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource The standard JSON format of a MongoDB collection. + * @return the next definition stage. + */ + WithCreate withResource(MongoDBCollectionResource resource); + } + /** + * The stage of the MongoDBCollectionGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + MongoDBCollectionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MongoDBCollectionGetResults create(Context context); + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the MongoDBCollectionGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the MongoDBCollectionGetResults resource. + * + * @return the stage of resource update. + */ + MongoDBCollectionGetResults.Update update(); + + /** The template for MongoDBCollectionGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MongoDBCollectionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MongoDBCollectionGetResults apply(Context context); + } + /** The MongoDBCollectionGetResults update stages. */ + interface UpdateStages { + /** The stage of the MongoDBCollectionGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MongoDBCollectionGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the MongoDBCollectionGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a MongoDB collection. + * + * @param resource The standard JSON format of a MongoDB collection. + * @return the next definition stage. + */ + Update withResource(MongoDBCollectionResource resource); + } + /** The stage of the MongoDBCollectionGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MongoDBCollectionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MongoDBCollectionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java new file mode 100644 index 0000000000000..1b52e1731f627 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBCollectionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collections and their properties. */ +@Immutable +public final class MongoDBCollectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionListResult.class); + + /* + * List of MongoDB collections and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB collections and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java new file mode 100644 index 0000000000000..93caa7c899e88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBCollectionResource.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public class MongoDBCollectionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBCollectionResource.class); + + /* + * Name of the Cosmos DB MongoDB collection + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * A key-value pair of shard keys to be applied for the request. + */ + @JsonProperty(value = "shardKey") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map shardKey; + + /* + * List of index keys + */ + @JsonProperty(value = "indexes") + private List indexes; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Integer analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB MongoDB collection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB MongoDB collection. + * + * @param id the id value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the shardKey property: A key-value pair of shard keys to be applied for the request. + * + * @return the shardKey value. + */ + public Map shardKey() { + return this.shardKey; + } + + /** + * Set the shardKey property: A key-value pair of shard keys to be applied for the request. + * + * @param shardKey the shardKey value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withShardKey(Map shardKey) { + this.shardKey = shardKey; + return this; + } + + /** + * Get the indexes property: List of index keys. + * + * @return the indexes value. + */ + public List indexes() { + return this.indexes; + } + + /** + * Set the indexes property: List of index keys. + * + * @param indexes the indexes value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Integer analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withAnalyticalStorageTtl(Integer analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBCollectionResource")); + } + if (indexes() != null) { + indexes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..5cf766c148cd9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB MongoDB database. */ +@Fluent +public final class MongoDBDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB MongoDB database. + */ + @JsonProperty(value = "properties", required = true) + private MongoDBDatabaseCreateUpdateProperties innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB MongoDB database. + * + * @return the innerProperties value. + */ + private MongoDBDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a MongoDB database. + * + * @return the resource value. + */ + public MongoDBDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a MongoDB database. + * + * @param resource the resource value to set. + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withResource(MongoDBDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new MongoDBDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model MongoDBDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..459bf7a066047 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MongoDBDatabaseGetPropertiesOptions model. */ +@Fluent +public final class MongoDBDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..425d0de616926 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MongoDBDatabaseGetPropertiesResource model. */ +@Fluent +public final class MongoDBDatabaseGetPropertiesResource extends MongoDBDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public MongoDBDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java new file mode 100644 index 0000000000000..1acab760686f2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of MongoDBDatabaseGetResults. */ +public interface MongoDBDatabaseGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + MongoDBDatabaseGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + MongoDBDatabaseGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner object. + * + * @return the inner object. + */ + MongoDBDatabaseGetResultsInner innerModel(); + + /** The entirety of the MongoDBDatabaseGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The MongoDBDatabaseGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the MongoDBDatabaseGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a MongoDB database. + * + * @param resource The standard JSON format of a MongoDB database. + * @return the next definition stage. + */ + WithCreate withResource(MongoDBDatabaseResource resource); + } + /** + * The stage of the MongoDBDatabaseGetResults definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + MongoDBDatabaseGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MongoDBDatabaseGetResults create(Context context); + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the MongoDBDatabaseGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the MongoDBDatabaseGetResults resource. + * + * @return the stage of resource update. + */ + MongoDBDatabaseGetResults.Update update(); + + /** The template for MongoDBDatabaseGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MongoDBDatabaseGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MongoDBDatabaseGetResults apply(Context context); + } + /** The MongoDBDatabaseGetResults update stages. */ + interface UpdateStages { + /** The stage of the MongoDBDatabaseGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MongoDBDatabaseGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the MongoDBDatabaseGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a MongoDB database. + * + * @param resource The standard JSON format of a MongoDB database. + * @return the next definition stage. + */ + Update withResource(MongoDBDatabaseResource resource); + } + /** The stage of the MongoDBDatabaseGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MongoDBDatabaseGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MongoDBDatabaseGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.java new file mode 100644 index 0000000000000..55a27bf9be6ca --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.MongoDBDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB databases and their properties. */ +@Immutable +public final class MongoDBDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseListResult.class); + + /* + * List of MongoDB databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java new file mode 100644 index 0000000000000..69c046ac6fc2d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB database resource object. */ +@Fluent +public class MongoDBDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoDBDatabaseResource.class); + + /* + * Name of the Cosmos DB MongoDB database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB MongoDB database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB MongoDB database. + * + * @param id the id value to set. + * @return the MongoDBDatabaseResource object itself. + */ + public MongoDBDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model MongoDBDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java new file mode 100644 index 0000000000000..b207dec59558d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoDBResources.java @@ -0,0 +1,556 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of MongoDBResources. */ +public interface MongoDBResources { + /** + * Lists the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + PagedIterable listMongoDBDatabases(String resourceGroupName, String accountName); + + /** + * Lists the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB databases and their properties. + */ + PagedIterable listMongoDBDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the MongoDB databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + MongoDBDatabaseGetResults getMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the MongoDB databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getMongoDBDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the MongoDB database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getMongoDBDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the MongoDB database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getMongoDBDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @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 updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB + * database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collections and their properties. + */ + PagedIterable listMongoDBCollections( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + MongoDBCollectionGetResults getMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + Response getMongoDBCollectionWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollection( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getMongoDBCollectionThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getMongoDBCollectionThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateMongoDBCollectionThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String collectionName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToAutoscale( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateMongoDBCollectionToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String collectionName, Context context); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + MongoDBDatabaseGetResults getMongoDBDatabaseById(String id); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + */ + Response getMongoDBDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + MongoDBCollectionGetResults getMongoDBCollectionById(String id); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the MongoDB collection under an existing Azure Cosmos DB database account. + */ + Response getMongoDBCollectionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollectionById(String id); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMongoDBCollectionByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MongoDBDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoDBDatabaseGetResults definition. + */ + MongoDBDatabaseGetResults.DefinitionStages.Blank defineUpdateMongoDBDatabase(String name); + + /** + * Begins definition for a new MongoDBCollectionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new MongoDBCollectionGetResults definition. + */ + MongoDBCollectionGetResults.DefinitionStages.Blank defineUpdateMongoDBCollection(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java new file mode 100644 index 0000000000000..db749ce168cc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndex.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index key. */ +@Fluent +public final class MongoIndex { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndex.class); + + /* + * Cosmos DB MongoDB collection index keys + */ + @JsonProperty(value = "key") + private MongoIndexKeys key; + + /* + * Cosmos DB MongoDB collection index key options + */ + @JsonProperty(value = "options") + private MongoIndexOptions options; + + /** + * Get the key property: Cosmos DB MongoDB collection index keys. + * + * @return the key value. + */ + public MongoIndexKeys key() { + return this.key; + } + + /** + * Set the key property: Cosmos DB MongoDB collection index keys. + * + * @param key the key value to set. + * @return the MongoIndex object itself. + */ + public MongoIndex withKey(MongoIndexKeys key) { + this.key = key; + return this; + } + + /** + * Get the options property: Cosmos DB MongoDB collection index key options. + * + * @return the options value. + */ + public MongoIndexOptions options() { + return this.options; + } + + /** + * Set the options property: Cosmos DB MongoDB collection index key options. + * + * @param options the options value to set. + * @return the MongoIndex object itself. + */ + public MongoIndex withOptions(MongoIndexOptions options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() != null) { + key().validate(); + } + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java new file mode 100644 index 0000000000000..396dee7fa7f91 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexKeys.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Cosmos DB MongoDB collection resource object. */ +@Fluent +public final class MongoIndexKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndexKeys.class); + + /* + * List of keys for each MongoDB collection in the Azure Cosmos DB service + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Get the keys property: List of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: List of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @param keys the keys value to set. + * @return the MongoIndexKeys object itself. + */ + public MongoIndexKeys withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java new file mode 100644 index 0000000000000..fe58ceeba6c96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/MongoIndexOptions.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB MongoDB collection index options. */ +@Fluent +public final class MongoIndexOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MongoIndexOptions.class); + + /* + * Expire after seconds + */ + @JsonProperty(value = "expireAfterSeconds") + private Integer expireAfterSeconds; + + /* + * Is unique or not + */ + @JsonProperty(value = "unique") + private Boolean unique; + + /** + * Get the expireAfterSeconds property: Expire after seconds. + * + * @return the expireAfterSeconds value. + */ + public Integer expireAfterSeconds() { + return this.expireAfterSeconds; + } + + /** + * Set the expireAfterSeconds property: Expire after seconds. + * + * @param expireAfterSeconds the expireAfterSeconds value to set. + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withExpireAfterSeconds(Integer expireAfterSeconds) { + this.expireAfterSeconds = expireAfterSeconds; + return this; + } + + /** + * Get the unique property: Is unique or not. + * + * @return the unique value. + */ + public Boolean unique() { + return this.unique; + } + + /** + * Set the unique property: Is unique or not. + * + * @param unique the unique value to set. + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withUnique(Boolean unique) { + this.unique = unique; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java new file mode 100644 index 0000000000000..e015eba4e8378 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NetworkAclBypass.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for NetworkAclBypass. */ +public enum NetworkAclBypass { + /** Enum value None. */ + NONE("None"), + + /** Enum value AzureServices. */ + AZURE_SERVICES("AzureServices"); + + /** The actual serialized value for a NetworkAclBypass instance. */ + private final String value; + + NetworkAclBypass(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NetworkAclBypass instance. + * + * @param value the serialized value to parse. + * @return the parsed NetworkAclBypass object, or null if unable to parse. + */ + @JsonCreator + public static NetworkAclBypass fromString(String value) { + NetworkAclBypass[] items = NetworkAclBypass.values(); + for (NetworkAclBypass item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.java new file mode 100644 index 0000000000000..9f2f6cf765d23 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NodeState. */ +public final class NodeState extends ExpandableStringEnum { + /** Static value Normal for NodeState. */ + public static final NodeState NORMAL = fromString("Normal"); + + /** Static value Leaving for NodeState. */ + public static final NodeState LEAVING = fromString("Leaving"); + + /** Static value Joining for NodeState. */ + public static final NodeState JOINING = fromString("Joining"); + + /** Static value Moving for NodeState. */ + public static final NodeState MOVING = fromString("Moving"); + + /** Static value Stopped for NodeState. */ + public static final NodeState STOPPED = fromString("Stopped"); + + /** + * Creates or finds a NodeState from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeState. + */ + @JsonCreator + public static NodeState fromString(String name) { + return fromString(name, NodeState.class); + } + + /** @return known NodeState values. */ + public static Collection values() { + return values(NodeState.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeStatus.java new file mode 100644 index 0000000000000..5b28abe6bbe11 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NodeStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NodeStatus. */ +public final class NodeStatus extends ExpandableStringEnum { + /** Static value Up for NodeStatus. */ + public static final NodeStatus UP = fromString("Up"); + + /** Static value Down for NodeStatus. */ + public static final NodeStatus DOWN = fromString("Down"); + + /** + * Creates or finds a NodeStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeStatus. + */ + @JsonCreator + public static NodeStatus fromString(String name) { + return fromString(name, NodeStatus.class); + } + + /** @return known NodeStatus values. */ + public static Collection values() { + return values(NodeStatus.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java new file mode 100644 index 0000000000000..cbbaa291d552b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspace.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; + +/** An immutable client-side representation of NotebookWorkspace. */ +public interface NotebookWorkspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + String notebookServerEndpoint(); + + /** + * Gets the status property: Status of the notebook workspace. Possible values are: Creating, Online, Deleting, + * Failed, Updating. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner object. + * + * @return the inner object. + */ + NotebookWorkspaceInner innerModel(); + + /** The entirety of the NotebookWorkspace definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The NotebookWorkspace definition stages. */ + interface DefinitionStages { + /** The first stage of the NotebookWorkspace definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the NotebookWorkspace definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the NotebookWorkspace definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + NotebookWorkspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NotebookWorkspace create(Context context); + } + } + /** + * Begins update for the NotebookWorkspace resource. + * + * @return the stage of resource update. + */ + NotebookWorkspace.Update update(); + + /** The template for NotebookWorkspace update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NotebookWorkspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NotebookWorkspace apply(Context context); + } + /** The NotebookWorkspace update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NotebookWorkspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NotebookWorkspace refresh(Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + NotebookWorkspaceConnectionInfoResult listConnectionInfo(); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + Response listConnectionInfoWithResponse(Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(Context context); + + /** + * Starts the notebook workspace. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Starts the notebook workspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java new file mode 100644 index 0000000000000..397d8142fc661 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceConnectionInfoResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner; + +/** An immutable client-side representation of NotebookWorkspaceConnectionInfoResult. */ +public interface NotebookWorkspaceConnectionInfoResult { + /** + * Gets the authToken property: Specifies auth token used for connecting to Notebook server (uses token-based auth). + * + * @return the authToken value. + */ + String authToken(); + + /** + * Gets the notebookServerEndpoint property: Specifies the endpoint of Notebook server. + * + * @return the notebookServerEndpoint value. + */ + String notebookServerEndpoint(); + + /** + * Gets the inner + * com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceConnectionInfoResultInner object. + * + * @return the inner object. + */ + NotebookWorkspaceConnectionInfoResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java new file mode 100644 index 0000000000000..039ebf8d94924 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceCreateUpdateParameters.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Parameters to create a notebook workspace resource. */ +@Immutable +public final class NotebookWorkspaceCreateUpdateParameters extends ArmProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceCreateUpdateParameters.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java new file mode 100644 index 0000000000000..29d99c23ce2e6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.NotebookWorkspaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of notebook workspace resources. */ +@Fluent +public final class NotebookWorkspaceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotebookWorkspaceListResult.class); + + /* + * Array of notebook workspace resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of notebook workspace resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of notebook workspace resources. + * + * @param value the value value to set. + * @return the NotebookWorkspaceListResult object itself. + */ + public NotebookWorkspaceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java new file mode 100644 index 0000000000000..75b45a100985a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaceName.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NotebookWorkspaceName. */ +public final class NotebookWorkspaceName extends ExpandableStringEnum { + /** Static value default for NotebookWorkspaceName. */ + public static final NotebookWorkspaceName DEFAULT = fromString("default"); + + /** + * Creates or finds a NotebookWorkspaceName from its string representation. + * + * @param name a name to look for. + * @return the corresponding NotebookWorkspaceName. + */ + @JsonCreator + public static NotebookWorkspaceName fromString(String name) { + return fromString(name, NotebookWorkspaceName.class); + } + + /** @return known NotebookWorkspaceName values. */ + public static Collection values() { + return values(NotebookWorkspaceName.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java new file mode 100644 index 0000000000000..995e59c01e8a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/NotebookWorkspaces.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of NotebookWorkspaces. */ +public interface NotebookWorkspaces { + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace resources of an existing Cosmos DB account. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + NotebookWorkspace get(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + Response getWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + NotebookWorkspaceConnectionInfoResult listConnectionInfo( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Retrieves the connection info for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the connection info for the given notebook workspace. + */ + Response listConnectionInfoWithResponse( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Regenerates the auth token for the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void regenerateAuthToken( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName); + + /** + * Starts the notebook workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookWorkspaceName The name of the notebook workspace resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start( + String resourceGroupName, String accountName, NotebookWorkspaceName notebookWorkspaceName, Context context); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + NotebookWorkspace getById(String id); + + /** + * Gets the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the notebook workspace for a Cosmos DB account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NotebookWorkspace resource. + * + * @param name resource name. + * @return the first stage of the new NotebookWorkspace definition. + */ + NotebookWorkspace.DefinitionStages.Blank define(NotebookWorkspaceName name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java new file mode 100644 index 0000000000000..76002cb51dcf0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..c3ed67a976cb1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.ResourceProvider + */ + @JsonProperty(value = "Provider") + private String provider; + + /* + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "Resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "Operation") + private String operation; + + /* + * Description of operation + */ + @JsonProperty(value = "Description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft.ResourceProvider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.ResourceProvider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..34bdae9c9074e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Resource Provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java new file mode 100644 index 0000000000000..93e513cc0c512 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OperationType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationType. */ +public final class OperationType extends ExpandableStringEnum { + /** Static value Create for OperationType. */ + public static final OperationType CREATE = fromString("Create"); + + /** Static value Replace for OperationType. */ + public static final OperationType REPLACE = fromString("Replace"); + + /** Static value Delete for OperationType. */ + public static final OperationType DELETE = fromString("Delete"); + + /** Static value SystemOperation for OperationType. */ + public static final OperationType SYSTEM_OPERATION = fromString("SystemOperation"); + + /** + * Creates or finds a OperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationType. + */ + @JsonCreator + public static OperationType fromString(String name) { + return fromString(name, OperationType.class); + } + + /** @return known OperationType values. */ + public static Collection values() { + return values(OperationType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java new file mode 100644 index 0000000000000..f35de9660ff88 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + PagedIterable list(); + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Resource Provider operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java new file mode 100644 index 0000000000000..34e378a40ab08 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/OptionsResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB options resource object. */ +@Fluent +public class OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OptionsResource.class); + + /* + * Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Specifies the Autoscale settings. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettings autoscaleSettings; + + /** + * Get the throughput property: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + * ThroughputSetting resource when retrieving offer details. + * + * @param throughput the throughput value to set. + * @return the OptionsResource object itself. + */ + public OptionsResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Specifies the Autoscale settings. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettings autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Specifies the Autoscale settings. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the OptionsResource object itself. + */ + public OptionsResource withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java new file mode 100644 index 0000000000000..7bcd132393a50 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIdRegions.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIdRegions. */ +public interface PartitionKeyRangeIdRegions { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String region, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java new file mode 100644 index 0000000000000..33de15685ad58 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKeyRangeIds.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PartitionKeyRangeIds. */ +public interface PartitionKeyRangeIds { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter); + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list partition metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String databaseRid, + String collectionRid, + String partitionKeyRangeId, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java new file mode 100644 index 0000000000000..ab15e9f9df0f9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionKind.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PartitionKind. */ +public final class PartitionKind extends ExpandableStringEnum { + /** Static value Hash for PartitionKind. */ + public static final PartitionKind HASH = fromString("Hash"); + + /** Static value Range for PartitionKind. */ + public static final PartitionKind RANGE = fromString("Range"); + + /** Static value MultiHash for PartitionKind. */ + public static final PartitionKind MULTI_HASH = fromString("MultiHash"); + + /** + * Creates or finds a PartitionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding PartitionKind. + */ + @JsonCreator + public static PartitionKind fromString(String name) { + return fromString(name, PartitionKind.class); + } + + /** @return known PartitionKind values. */ + public static Collection values() { + return values(PartitionKind.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java new file mode 100644 index 0000000000000..b044ed0c8b8f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetric.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PartitionMetric. */ +public interface PartitionMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the metric values. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner object. + * + * @return the inner object. + */ + PartitionMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java new file mode 100644 index 0000000000000..a10afb5a5578e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition metrics request. */ +@Immutable +public final class PartitionMetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionMetricListResult.class); + + /* + * The list of partition-level metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of partition-level metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java new file mode 100644 index 0000000000000..de30efd7d99e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; + +/** An immutable client-side representation of PartitionUsage. */ +public interface PartitionUsage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the partitionId property: The partition id (GUID identifier) of the usages. + * + * @return the partitionId value. + */ + String partitionId(); + + /** + * Gets the partitionKeyRangeId property: The partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner object. + * + * @return the inner object. + */ + PartitionUsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java new file mode 100644 index 0000000000000..9ca35dd838e9e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PartitionUsagesResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PartitionUsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list partition level usage request. */ +@Immutable +public final class PartitionUsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PartitionUsagesResult.class); + + /* + * The list of partition-level usages for the database. A usage is a point + * in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of partition-level usages for the database. A usage is a point in time metric. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java new file mode 100644 index 0000000000000..16fa1416ea65a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of PercentileMetric. */ +public interface PercentileMetric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time grain to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The percentile metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner object. + * + * @return the inner object. + */ + PercentileMetricInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java new file mode 100644 index 0000000000000..ba0f84ce100fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PercentileMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list percentile metrics request. */ +@Immutable +public final class PercentileMetricListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricListResult.class); + + /* + * The list of percentile metrics for the account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of percentile metrics for the account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java new file mode 100644 index 0000000000000..43bee343c577b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileMetricValue.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents percentile metrics values. */ +@Immutable +public final class PercentileMetricValue extends MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentileMetricValue.class); + + /* + * The 10th percentile value for the metric. + */ + @JsonProperty(value = "P10", access = JsonProperty.Access.WRITE_ONLY) + private Double p10; + + /* + * The 25th percentile value for the metric. + */ + @JsonProperty(value = "P25", access = JsonProperty.Access.WRITE_ONLY) + private Double p25; + + /* + * The 50th percentile value for the metric. + */ + @JsonProperty(value = "P50", access = JsonProperty.Access.WRITE_ONLY) + private Double p50; + + /* + * The 75th percentile value for the metric. + */ + @JsonProperty(value = "P75", access = JsonProperty.Access.WRITE_ONLY) + private Double p75; + + /* + * The 90th percentile value for the metric. + */ + @JsonProperty(value = "P90", access = JsonProperty.Access.WRITE_ONLY) + private Double p90; + + /* + * The 95th percentile value for the metric. + */ + @JsonProperty(value = "P95", access = JsonProperty.Access.WRITE_ONLY) + private Double p95; + + /* + * The 99th percentile value for the metric. + */ + @JsonProperty(value = "P99", access = JsonProperty.Access.WRITE_ONLY) + private Double p99; + + /** + * Get the p10 property: The 10th percentile value for the metric. + * + * @return the p10 value. + */ + public Double p10() { + return this.p10; + } + + /** + * Get the p25 property: The 25th percentile value for the metric. + * + * @return the p25 value. + */ + public Double p25() { + return this.p25; + } + + /** + * Get the p50 property: The 50th percentile value for the metric. + * + * @return the p50 value. + */ + public Double p50() { + return this.p50; + } + + /** + * Get the p75 property: The 75th percentile value for the metric. + * + * @return the p75 value. + */ + public Double p75() { + return this.p75; + } + + /** + * Get the p90 property: The 90th percentile value for the metric. + * + * @return the p90 value. + */ + public Double p90() { + return this.p90; + } + + /** + * Get the p95 property: The 95th percentile value for the metric. + * + * @return the p95 value. + */ + public Double p95() { + return this.p95; + } + + /** + * Get the p99 property: The 99th percentile value for the metric. + * + * @return the p99 value. + */ + public Double p99() { + return this.p99; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java new file mode 100644 index 0000000000000..5759b85645203 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileSourceTargets.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileSourceTargets. */ +public interface PercentileSourceTargets { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is + * only for PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and + * each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, + String accountName, + String sourceRegion, + String targetRegion, + String filter, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java new file mode 100644 index 0000000000000..014015c40c714 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PercentileTargets.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PercentileTargets. */ +public interface PercentileTargets { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for + * PBS and Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each + * word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String targetRegion, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java new file mode 100644 index 0000000000000..f2ab6378cd9dd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Percentiles.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Percentiles. */ +public interface Percentiles { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and + * Replication Latency data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be + * filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and + * timeGrain. The supported operator is eq. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list percentile metrics request. + */ + PagedIterable listMetrics( + String resourceGroupName, String accountName, String filter, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java new file mode 100644 index 0000000000000..f4ee5ef401ac4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeBackupPolicy.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The object representing periodic mode backup policy. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Periodic") +@Fluent +public final class PeriodicModeBackupPolicy extends BackupPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeriodicModeBackupPolicy.class); + + /* + * Configuration values for periodic mode backup + */ + @JsonProperty(value = "periodicModeProperties") + private PeriodicModeProperties periodicModeProperties; + + /** + * Get the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @return the periodicModeProperties value. + */ + public PeriodicModeProperties periodicModeProperties() { + return this.periodicModeProperties; + } + + /** + * Set the periodicModeProperties property: Configuration values for periodic mode backup. + * + * @param periodicModeProperties the periodicModeProperties value to set. + * @return the PeriodicModeBackupPolicy object itself. + */ + public PeriodicModeBackupPolicy withPeriodicModeProperties(PeriodicModeProperties periodicModeProperties) { + this.periodicModeProperties = periodicModeProperties; + return this; + } + + /** {@inheritDoc} */ + @Override + public PeriodicModeBackupPolicy withMigrationState(BackupPolicyMigrationState migrationState) { + super.withMigrationState(migrationState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (periodicModeProperties() != null) { + periodicModeProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java new file mode 100644 index 0000000000000..5db3772b68ae0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PeriodicModeProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration values for periodic mode backup. */ +@Fluent +public final class PeriodicModeProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeriodicModeProperties.class); + + /* + * An integer representing the interval in minutes between two backups + */ + @JsonProperty(value = "backupIntervalInMinutes") + private Integer backupIntervalInMinutes; + + /* + * An integer representing the time (in hours) that each backup is retained + */ + @JsonProperty(value = "backupRetentionIntervalInHours") + private Integer backupRetentionIntervalInHours; + + /* + * Enum to indicate type of backup residency + */ + @JsonProperty(value = "backupStorageRedundancy") + private BackupStorageRedundancy backupStorageRedundancy; + + /** + * Get the backupIntervalInMinutes property: An integer representing the interval in minutes between two backups. + * + * @return the backupIntervalInMinutes value. + */ + public Integer backupIntervalInMinutes() { + return this.backupIntervalInMinutes; + } + + /** + * Set the backupIntervalInMinutes property: An integer representing the interval in minutes between two backups. + * + * @param backupIntervalInMinutes the backupIntervalInMinutes value to set. + * @return the PeriodicModeProperties object itself. + */ + public PeriodicModeProperties withBackupIntervalInMinutes(Integer backupIntervalInMinutes) { + this.backupIntervalInMinutes = backupIntervalInMinutes; + return this; + } + + /** + * Get the backupRetentionIntervalInHours property: An integer representing the time (in hours) that each backup is + * retained. + * + * @return the backupRetentionIntervalInHours value. + */ + public Integer backupRetentionIntervalInHours() { + return this.backupRetentionIntervalInHours; + } + + /** + * Set the backupRetentionIntervalInHours property: An integer representing the time (in hours) that each backup is + * retained. + * + * @param backupRetentionIntervalInHours the backupRetentionIntervalInHours value to set. + * @return the PeriodicModeProperties object itself. + */ + public PeriodicModeProperties withBackupRetentionIntervalInHours(Integer backupRetentionIntervalInHours) { + this.backupRetentionIntervalInHours = backupRetentionIntervalInHours; + return this; + } + + /** + * Get the backupStorageRedundancy property: Enum to indicate type of backup residency. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * Set the backupStorageRedundancy property: Enum to indicate type of backup residency. + * + * @param backupStorageRedundancy the backupStorageRedundancy value to set. + * @return the PeriodicModeProperties object itself. + */ + public PeriodicModeProperties withBackupStorageRedundancy(BackupStorageRedundancy backupStorageRedundancy) { + this.backupStorageRedundancy = backupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java new file mode 100644 index 0000000000000..e9da4d5f661e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Permission.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The set of data plane operations permitted through this Role Definition. */ +@Fluent +public final class Permission { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Permission.class); + + /* + * An array of data actions that are allowed. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /* + * An array of data actions that are denied. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** + * Get the dataActions property: An array of data actions that are allowed. + * + * @return the dataActions value. + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set the dataActions property: An array of data actions that are allowed. + * + * @param dataActions the dataActions value to set. + * @return the Permission object itself. + */ + public Permission withDataActions(List dataActions) { + this.dataActions = dataActions; + return this; + } + + /** + * Get the notDataActions property: An array of data actions that are denied. + * + * @return the notDataActions value. + */ + public List notDataActions() { + return this.notDataActions; + } + + /** + * Set the notDataActions property: An array of data actions that are denied. + * + * @param notDataActions the notDataActions value to set. + * @return the Permission object itself. + */ + public Permission withNotDataActions(List notDataActions) { + this.notDataActions = notDataActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java new file mode 100644 index 0000000000000..2520f1d5a3798 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrimaryAggregationType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrimaryAggregationType. */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** Static value Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Last for PrimaryAggregationType. */ + public static final PrimaryAggregationType LAST = fromString("Last"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrimaryAggregationType. + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** @return known PrimaryAggregationType values. */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..cde2d709ef7b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the groupId property: Group id of the private endpoint. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the provisioningState property: Provisioning state of the private endpoint. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, + DefinitionStages.WithPrivateLinkServiceConnectionState, + DefinitionStages.WithGroupId, + DefinitionStages.WithProvisioningState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify groupId. */ + interface WithGroupId { + /** + * Specifies the groupId property: Group id of the private endpoint.. + * + * @param groupId Group id of the private endpoint. + * @return the next definition stage. + */ + WithCreate withGroupId(String groupId); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning state of the private endpoint.. + * + * @param provisioningState Provisioning state of the private endpoint. + * @return the next definition stage. + */ + WithCreate withProvisioningState(String provisioningState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update + extends UpdateStages.WithPrivateEndpoint, + UpdateStages.WithPrivateLinkServiceConnectionState, + UpdateStages.WithGroupId, + UpdateStages.WithProvisioningState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + /** The stage of the PrivateEndpointConnection update allowing to specify groupId. */ + interface WithGroupId { + /** + * Specifies the groupId property: Group id of the private endpoint.. + * + * @param groupId Group id of the private endpoint. + * @return the next definition stage. + */ + Update withGroupId(String groupId); + } + /** The stage of the PrivateEndpointConnection update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning state of the private endpoint.. + * + * @param provisioningState Provisioning state of the private endpoint. + * @return the next definition stage. + */ + Update withProvisioningState(String provisioningState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..05a9f0e09a630 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..ca1c174c85caa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..7cdc91ea126b3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint which the connection belongs to. */ +@Fluent +public final class PrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); + + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..0cd8da5dfa317 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResource.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..4aaf6e3f327db --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.class); + + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..adccda1837700 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkResources.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PagedIterable listByDatabaseAccount(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PagedIterable listByDatabaseAccount( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + PrivateLinkResource get(String resourceGroupName, String accountName, String groupName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cosmos DB account. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String groupName, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..b3d8f861943e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connection State of the Private Endpoint Connection. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Any action that is required beyond basic workflow (approve/ reject/ + * disconnect) + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: Any action that is required beyond basic workflow (approve/ reject/ + * disconnect). + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..d78b0f3debc73 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/PublicNetworkAccess.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java new file mode 100644 index 0000000000000..9e1316e4e9842 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionForOnlineOffline.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB region to online or offline. */ +@Fluent +public final class RegionForOnlineOffline { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegionForOnlineOffline.class); + + /* + * Cosmos DB region, with spaces between words and each word capitalized. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the region property: Cosmos DB region, with spaces between words and each word capitalized. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: Cosmos DB region, with spaces between words and each word capitalized. + * + * @param region the region value to set. + * @return the RegionForOnlineOffline object itself. + */ + public RegionForOnlineOffline withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (region() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property region in model RegionForOnlineOffline")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionalServiceResource.java new file mode 100644 index 0000000000000..e7de2df72bd35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RegionalServiceResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public class RegionalServiceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegionalServiceResource.class); + + /* + * The regional service name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The location name. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Describes the status of a service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ServiceStatus status; + + /** + * Get the name property: The regional service name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the location property: The location name. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + public ServiceStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RepairPostBody.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RepairPostBody.java new file mode 100644 index 0000000000000..078446152962e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RepairPostBody.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specification of the keyspaces and tables to run repair on. */ +@Fluent +public final class RepairPostBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RepairPostBody.class); + + /* + * The name of the keyspace that repair should be run on. + */ + @JsonProperty(value = "keyspace", required = true) + private String keyspace; + + /* + * List of tables in the keyspace to repair. If omitted, repair all tables + * in the keyspace. + */ + @JsonProperty(value = "tables") + private List tables; + + /** + * Get the keyspace property: The name of the keyspace that repair should be run on. + * + * @return the keyspace value. + */ + public String keyspace() { + return this.keyspace; + } + + /** + * Set the keyspace property: The name of the keyspace that repair should be run on. + * + * @param keyspace the keyspace value to set. + * @return the RepairPostBody object itself. + */ + public RepairPostBody withKeyspace(String keyspace) { + this.keyspace = keyspace; + return this; + } + + /** + * Get the tables property: List of tables in the keyspace to repair. If omitted, repair all tables in the keyspace. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Set the tables property: List of tables in the keyspace to repair. If omitted, repair all tables in the keyspace. + * + * @param tables the tables value to set. + * @return the RepairPostBody object itself. + */ + public RepairPostBody withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyspace() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyspace in model RepairPostBody")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..0e59098f26fdc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceIdentityType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned,UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned,UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceProviders.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceProviders.java new file mode 100644 index 0000000000000..f61e12712e3b2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ResourceProviders.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * List Cosmos DB locations and their properties. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + PagedIterable list(); + + /** + * List Cosmos DB locations and their properties. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains Cosmos DB locations and their properties. + */ + PagedIterable list(Context context); + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + LocationGetResult locationGet(String location); + + /** + * Get the properties of an existing Cosmos DB location. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an existing Cosmos DB location. + */ + Response locationGetWithResponse(String location, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java new file mode 100644 index 0000000000000..5584ffa5389b1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountGetResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of RestorableDatabaseAccountGetResult. */ +public interface RestorableDatabaseAccountGetResult { + /** + * Gets the id property: The unique resource identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the resource group to which the resource belongs. + * + * @return the location value. + */ + String location(); + + /** + * Gets the accountName property: The name of the global database account. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the creationTime property: The creation time of the restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the deletionTime property: The time at which the restorable database account has been deleted (ISO-8601 + * format). + * + * @return the deletionTime value. + */ + OffsetDateTime deletionTime(); + + /** + * Gets the apiType property: The API type of the restorable database account. + * + * @return the apiType value. + */ + ApiType apiType(); + + /** + * Gets the restorableLocations property: List of regions where the of the database account can be restored from. + * + * @return the restorableLocations value. + */ + List restorableLocations(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner + * object. + * + * @return the inner object. + */ + RestorableDatabaseAccountGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java new file mode 100644 index 0000000000000..f8e9264876b1e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccounts.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableDatabaseAccounts. */ +public interface RestorableDatabaseAccounts { + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable listByLocation(String location); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This + * call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable listByLocation(String location, Context context); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable list(); + + /** + * Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable database accounts and their properties. + */ + PagedIterable list(Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + RestorableDatabaseAccountGetResult getByLocation(String location, String instanceId); + + /** + * Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Cosmos DB restorable database account. + */ + Response getByLocationWithResponse( + String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java new file mode 100644 index 0000000000000..ac662009c229d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableDatabaseAccountsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableDatabaseAccountGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable database accounts and their properties. */ +@Immutable +public final class RestorableDatabaseAccountsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableDatabaseAccountsListResult.class); + + /* + * List of restorable database accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable database accounts and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java new file mode 100644 index 0000000000000..91fcc757c7e52 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableLocationResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of the regional restorable account. */ +@Immutable +public final class RestorableLocationResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableLocationResource.class); + + /* + * The location of the regional restorable account. + */ + @JsonProperty(value = "locationName", access = JsonProperty.Access.WRITE_ONLY) + private String locationName; + + /* + * The instance id of the regional restorable account. + */ + @JsonProperty(value = "regionalDatabaseAccountInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String regionalDatabaseAccountInstanceId; + + /* + * The creation time of the regional restorable database account (ISO-8601 + * format). + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * The time at which the regional restorable database account has been + * deleted (ISO-8601 format). + */ + @JsonProperty(value = "deletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionTime; + + /** + * Get the locationName property: The location of the regional restorable account. + * + * @return the locationName value. + */ + public String locationName() { + return this.locationName; + } + + /** + * Get the regionalDatabaseAccountInstanceId property: The instance id of the regional restorable account. + * + * @return the regionalDatabaseAccountInstanceId value. + */ + public String regionalDatabaseAccountInstanceId() { + return this.regionalDatabaseAccountInstanceId; + } + + /** + * Get the creationTime property: The creation time of the regional restorable database account (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Get the deletionTime property: The time at which the regional restorable database account has been deleted + * (ISO-8601 format). + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.deletionTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java new file mode 100644 index 0000000000000..62529fb0ffc77 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; + +/** An immutable client-side representation of RestorableMongodbCollectionGetResult. */ +public interface RestorableMongodbCollectionGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB collection event. + * + * @return the resource value. + */ + RestorableMongodbCollectionPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbCollectionGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java new file mode 100644 index 0000000000000..82bb1565b613e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionPropertiesResource.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB collection event. */ +@Immutable +public final class RestorableMongodbCollectionPropertiesResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this collection event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this collection event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB collection. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB collection. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this collection event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this collection event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB collection. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB collection. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java new file mode 100644 index 0000000000000..b86a7d621abf6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollections.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbCollections. */ +public interface RestorableMongodbCollections { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific + * database. This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableMongodbDatabaseRid The resource ID of the MongoDB database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB collection events and their properties. + */ + PagedIterable list( + String location, String instanceId, String restorableMongodbDatabaseRid, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java new file mode 100644 index 0000000000000..a75e7b7bca272 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbCollectionsListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbCollectionGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB collection events and their properties. */ +@Immutable +public final class RestorableMongodbCollectionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbCollectionsListResult.class); + + /* + * List of MongoDB collection events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB collection events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java new file mode 100644 index 0000000000000..f0e1414c9e7c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableMongodbDatabaseGetResult. */ +public interface RestorableMongodbDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB MongoDB database event. + * + * @return the resource value. + */ + RestorableMongodbDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableMongodbDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java new file mode 100644 index 0000000000000..4473433b12aba --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasePropertiesResource.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB MongoDB database event. */ +@Immutable +public final class RestorableMongodbDatabasePropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasePropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this MongoDB database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this MongoDB database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this database event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this MongoDB database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this MongoDB database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java new file mode 100644 index 0000000000000..8cb1028983541 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabases.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbDatabases. */ +public interface RestorableMongodbDatabases { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable + * account. This helps in scenario where database was accidentally deleted to get the deletion time. This API + * requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the MongoDB database events and their properties. + */ + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java new file mode 100644 index 0000000000000..4b585e3d98b3b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableMongodbDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the MongoDB database events and their properties. */ +@Immutable +public final class RestorableMongodbDatabasesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbDatabasesListResult.class); + + /* + * List of MongoDB database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of MongoDB database events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java new file mode 100644 index 0000000000000..db96743936264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableMongodbResources. */ +public interface RestorableMongodbResources { + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and collection combo that exist on the account at the given timestamp and location. + * This helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable MongoDB resources. + */ + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java new file mode 100644 index 0000000000000..37d7ec074752f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableMongodbResourcesListResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable MongoDB resources. */ +@Immutable +public final class RestorableMongodbResourcesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableMongodbResourcesListResult.class); + + /* + * List of restorable MongoDB resources, including the database and + * collection names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable MongoDB resources, including the database and collection names. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java new file mode 100644 index 0000000000000..f491902574b3c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; + +/** An immutable client-side representation of RestorableSqlContainerGetResult. */ +public interface RestorableSqlContainerGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL container event. + * + * @return the resource value. + */ + RestorableSqlContainerPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlContainerGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java new file mode 100644 index 0000000000000..95f3c202a81a1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL container event. */ +@Fluent +public final class RestorableSqlContainerPropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainerPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this container event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The when this container event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of this SQL container. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of this SQL container. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL container resource object + */ + @JsonProperty(value = "container") + private RestorableSqlContainerPropertiesResourceContainer container; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this container event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The when this container event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of this SQL container. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of this SQL container. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the container property: Cosmos DB SQL container resource object. + * + * @return the container value. + */ + public RestorableSqlContainerPropertiesResourceContainer container() { + return this.container; + } + + /** + * Set the container property: Cosmos DB SQL container resource object. + * + * @param container the container value to set. + * @return the RestorableSqlContainerPropertiesResource object itself. + */ + public RestorableSqlContainerPropertiesResource withContainer( + RestorableSqlContainerPropertiesResourceContainer container) { + this.container = container; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (container() != null) { + container().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java new file mode 100644 index 0000000000000..3d849dfdd0316 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainerPropertiesResourceContainer.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL container resource object. */ +@Fluent +public final class RestorableSqlContainerPropertiesResourceContainer extends SqlContainerResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableSqlContainerPropertiesResourceContainer.class); + + /* + * A system generated property that specifies the addressable path of the + * container resource. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the self property: A system generated property that specifies the addressable path of the container resource. + * + * @return the self value. + */ + public String self() { + return this.self; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlContainerPropertiesResourceContainer withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java new file mode 100644 index 0000000000000..24ce75dbf0bc8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainers.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlContainers. */ +public interface RestorableSqlContainers { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. + * This helps in scenario where container was accidentally deleted. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restorableSqlDatabaseRid The resource ID of the SQL database. + * @param startTime The snapshot create timestamp after which snapshots need to be listed. + * @param endTime The snapshot create timestamp before which snapshots need to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL container events and their properties. + */ + PagedIterable list( + String location, + String instanceId, + String restorableSqlDatabaseRid, + String startTime, + String endTime, + Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java new file mode 100644 index 0000000000000..e2b2cdcc3e2e8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlContainersListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlContainerGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL container events and their properties. */ +@Immutable +public final class RestorableSqlContainersListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlContainersListResult.class); + + /* + * List of SQL container events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL container events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java new file mode 100644 index 0000000000000..424dda4dc4692 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabaseGetResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; + +/** An immutable client-side representation of RestorableSqlDatabaseGetResult. */ +public interface RestorableSqlDatabaseGetResult { + /** + * Gets the id property: The unique resource Identifier of the ARM resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the ARM resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of Azure resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resource property: The resource of an Azure Cosmos DB SQL database event. + * + * @return the resource value. + */ + RestorableSqlDatabasePropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner + * object. + * + * @return the inner object. + */ + RestorableSqlDatabaseGetResultInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java new file mode 100644 index 0000000000000..4943cbc8d5b04 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResource.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource of an Azure Cosmos DB SQL database event. */ +@Fluent +public final class RestorableSqlDatabasePropertiesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasePropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * The operation type of this database event. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private OperationType operationType; + + /* + * The time when this database event happened. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String eventTimestamp; + + /* + * The name of the SQL database. + */ + @JsonProperty(value = "ownerId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerId; + + /* + * The resource ID of the SQL database. + */ + @JsonProperty(value = "ownerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String ownerResourceId; + + /* + * Cosmos DB SQL database resource object + */ + @JsonProperty(value = "database") + private RestorableSqlDatabasePropertiesResourceDatabase database; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the operationType property: The operation type of this database event. + * + * @return the operationType value. + */ + public OperationType operationType() { + return this.operationType; + } + + /** + * Get the eventTimestamp property: The time when this database event happened. + * + * @return the eventTimestamp value. + */ + public String eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the ownerId property: The name of the SQL database. + * + * @return the ownerId value. + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Get the ownerResourceId property: The resource ID of the SQL database. + * + * @return the ownerResourceId value. + */ + public String ownerResourceId() { + return this.ownerResourceId; + } + + /** + * Get the database property: Cosmos DB SQL database resource object. + * + * @return the database value. + */ + public RestorableSqlDatabasePropertiesResourceDatabase database() { + return this.database; + } + + /** + * Set the database property: Cosmos DB SQL database resource object. + * + * @param database the database value to set. + * @return the RestorableSqlDatabasePropertiesResource object itself. + */ + public RestorableSqlDatabasePropertiesResource withDatabase( + RestorableSqlDatabasePropertiesResourceDatabase database) { + this.database = database; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (database() != null) { + database().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java new file mode 100644 index 0000000000000..909c29566d5c7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasePropertiesResourceDatabase.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL database resource object. */ +@Fluent +public final class RestorableSqlDatabasePropertiesResourceDatabase extends SqlDatabaseResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasePropertiesResourceDatabase.class); + + /* + * A system generated property that specified the addressable path of the + * collections resource. + */ + @JsonProperty(value = "_colls", access = JsonProperty.Access.WRITE_ONLY) + private String colls; + + /* + * A system generated property that specifies the addressable path of the + * users resource. + */ + @JsonProperty(value = "_users", access = JsonProperty.Access.WRITE_ONLY) + private String users; + + /* + * A system generated property that specifies the addressable path of the + * database resource. + */ + @JsonProperty(value = "_self", access = JsonProperty.Access.WRITE_ONLY) + private String self; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @return the colls value. + */ + public String colls() { + return this.colls; + } + + /** + * Get the users property: A system generated property that specifies the addressable path of the users resource. + * + * @return the users value. + */ + public String users() { + return this.users; + } + + /** + * Get the self property: A system generated property that specifies the addressable path of the database resource. + * + * @return the self value. + */ + public String self() { + return this.self; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public RestorableSqlDatabasePropertiesResourceDatabase withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java new file mode 100644 index 0000000000000..864fbc18415ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabases.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlDatabases. */ +public interface RestorableSqlDatabases { + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + PagedIterable list(String location, String instanceId); + + /** + * Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. + * This helps in scenario where database was accidentally deleted to get the deletion time. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL database events and their properties. + */ + PagedIterable list(String location, String instanceId, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java new file mode 100644 index 0000000000000..1f8c2ff613422 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlDatabasesListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.RestorableSqlDatabaseGetResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL database events and their properties. */ +@Immutable +public final class RestorableSqlDatabasesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlDatabasesListResult.class); + + /* + * List of SQL database events and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL database events and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java new file mode 100644 index 0000000000000..ccb4c3d34b5af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableSqlResources. */ +public interface RestorableSqlResources { + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable SQL resources. + */ + PagedIterable list(String location, String instanceId); + + /** + * Return a list of database and container combo that exist on the account at the given timestamp and location. This + * helps in scenarios to validate what resources exist at given timestamp and location. This API requires + * 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + * + * @param location Cosmos DB region, with spaces between words and each word capitalized. + * @param instanceId The instanceId GUID of a restorable database account. + * @param restoreLocation The location where the restorable resources are located. + * @param restoreTimestampInUtc The timestamp when the restorable resources existed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the restorable SQL resources. + */ + PagedIterable list( + String location, String instanceId, String restoreLocation, String restoreTimestampInUtc, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java new file mode 100644 index 0000000000000..c37b8dbdf7944 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestorableSqlResourcesListResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the restorable SQL resources. */ +@Immutable +public final class RestorableSqlResourcesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorableSqlResourcesListResult.class); + + /* + * List of restorable SQL resources, including the database and collection + * names. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of restorable SQL resources, including the database and collection names. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java new file mode 100644 index 0000000000000..011403d52a00d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreMode.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreMode. */ +public final class RestoreMode extends ExpandableStringEnum { + /** Static value PointInTime for RestoreMode. */ + public static final RestoreMode POINT_IN_TIME = fromString("PointInTime"); + + /** + * Creates or finds a RestoreMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreMode. + */ + @JsonCreator + public static RestoreMode fromString(String name) { + return fromString(name, RestoreMode.class); + } + + /** @return known RestoreMode values. */ + public static Collection values() { + return values(RestoreMode.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java new file mode 100644 index 0000000000000..664ade4161b90 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RestoreParameters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Parameters to indicate the information about the restore. */ +@Fluent +public final class RestoreParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestoreParameters.class); + + /* + * Describes the mode of the restore. + */ + @JsonProperty(value = "restoreMode") + private RestoreMode restoreMode; + + /* + * The id of the restorable database account from which the restore has to + * be initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} + */ + @JsonProperty(value = "restoreSource") + private String restoreSource; + + /* + * Time to which the account has to be restored (ISO-8601 format). + */ + @JsonProperty(value = "restoreTimestampInUtc") + private OffsetDateTime restoreTimestampInUtc; + + /* + * List of specific databases available for restore. + */ + @JsonProperty(value = "databasesToRestore") + private List databasesToRestore; + + /** + * Get the restoreMode property: Describes the mode of the restore. + * + * @return the restoreMode value. + */ + public RestoreMode restoreMode() { + return this.restoreMode; + } + + /** + * Set the restoreMode property: Describes the mode of the restore. + * + * @param restoreMode the restoreMode value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreMode(RestoreMode restoreMode) { + this.restoreMode = restoreMode; + return this; + } + + /** + * Get the restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @return the restoreSource value. + */ + public String restoreSource() { + return this.restoreSource; + } + + /** + * Set the restoreSource property: The id of the restorable database account from which the restore has to be + * initiated. For example: + * /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + * + * @param restoreSource the restoreSource value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreSource(String restoreSource) { + this.restoreSource = restoreSource; + return this; + } + + /** + * Get the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @return the restoreTimestampInUtc value. + */ + public OffsetDateTime restoreTimestampInUtc() { + return this.restoreTimestampInUtc; + } + + /** + * Set the restoreTimestampInUtc property: Time to which the account has to be restored (ISO-8601 format). + * + * @param restoreTimestampInUtc the restoreTimestampInUtc value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withRestoreTimestampInUtc(OffsetDateTime restoreTimestampInUtc) { + this.restoreTimestampInUtc = restoreTimestampInUtc; + return this; + } + + /** + * Get the databasesToRestore property: List of specific databases available for restore. + * + * @return the databasesToRestore value. + */ + public List databasesToRestore() { + return this.databasesToRestore; + } + + /** + * Set the databasesToRestore property: List of specific databases available for restore. + * + * @param databasesToRestore the databasesToRestore value to set. + * @return the RestoreParameters object itself. + */ + public RestoreParameters withDatabasesToRestore(List databasesToRestore) { + this.databasesToRestore = databasesToRestore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databasesToRestore() != null) { + databasesToRestore().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java new file mode 100644 index 0000000000000..6ccf0190121cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/RoleDefinitionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RoleDefinitionType. */ +public enum RoleDefinitionType { + /** Enum value BuiltInRole. */ + BUILT_IN_ROLE("BuiltInRole"), + + /** Enum value CustomRole. */ + CUSTOM_ROLE("CustomRole"); + + /** The actual serialized value for a RoleDefinitionType instance. */ + private final String value; + + RoleDefinitionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RoleDefinitionType instance. + * + * @param value the serialized value to parse. + * @return the parsed RoleDefinitionType object, or null if unable to parse. + */ + @JsonCreator + public static RoleDefinitionType fromString(String value) { + RoleDefinitionType[] items = RoleDefinitionType.values(); + for (RoleDefinitionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java new file mode 100644 index 0000000000000..dc4e120e8826b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SeedNode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SeedNode model. */ +@Fluent +public final class SeedNode { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SeedNode.class); + + /* + * IP address of this seed node. + */ + @JsonProperty(value = "ipAddress") + private String ipAddress; + + /** + * Get the ipAddress property: IP address of this seed node. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: IP address of this seed node. + * + * @param ipAddress the ipAddress value to set. + * @return the SeedNode object itself. + */ + public SeedNode withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java new file mode 100644 index 0000000000000..0376f92582a09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServerVersion.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerVersion. */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 3.2 for ServerVersion. */ + public static final ServerVersion THREE_TWO = fromString("3.2"); + + /** Static value 3.6 for ServerVersion. */ + public static final ServerVersion THREE_SIX = fromString("3.6"); + + /** Static value 4.0 for ServerVersion. */ + public static final ServerVersion FOUR_ZERO = fromString("4.0"); + + /** + * Creates or finds a ServerVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVersion. + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** @return known ServerVersion values. */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResource.java new file mode 100644 index 0000000000000..311531e29905e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResource.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; + +/** An immutable client-side representation of ServiceResource. */ +public interface ServiceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Services response resource. + * + * @return the properties value. + */ + ServiceResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner object. + * + * @return the inner object. + */ + ServiceResourceInner innerModel(); + + /** The entirety of the ServiceResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServiceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServiceResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the ServiceResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithInstanceSize, + DefinitionStages.WithInstanceCount, + DefinitionStages.WithServiceType { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceResource create(Context context); + } + /** The stage of the ServiceResource definition allowing to specify instanceSize. */ + interface WithInstanceSize { + /** + * Specifies the instanceSize property: Instance type for the service.. + * + * @param instanceSize Instance type for the service. + * @return the next definition stage. + */ + WithCreate withInstanceSize(ServiceSize instanceSize); + } + /** The stage of the ServiceResource definition allowing to specify instanceCount. */ + interface WithInstanceCount { + /** + * Specifies the instanceCount property: Instance count for the service.. + * + * @param instanceCount Instance count for the service. + * @return the next definition stage. + */ + WithCreate withInstanceCount(Integer instanceCount); + } + /** The stage of the ServiceResource definition allowing to specify serviceType. */ + interface WithServiceType { + /** + * Specifies the serviceType property: ServiceType for the service.. + * + * @param serviceType ServiceType for the service. + * @return the next definition stage. + */ + WithCreate withServiceType(ServiceType serviceType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceResource refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java new file mode 100644 index 0000000000000..12f6c5b2c90b5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceCreateUpdateParameters.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for Create or Update Request for ServiceResource. */ +@Fluent +public final class ServiceResourceCreateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceCreateUpdateParameters.class); + + /* + * Properties in ServiceResourceCreateUpdateParameters. + */ + @JsonProperty(value = "properties") + private ServiceResourceCreateUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Properties in ServiceResourceCreateUpdateParameters. + * + * @return the innerProperties value. + */ + private ServiceResourceCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.innerProperties() == null ? null : this.innerProperties().instanceSize(); + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withInstanceSize(ServiceSize instanceSize) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withInstanceSize(instanceSize); + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.innerProperties() == null ? null : this.innerProperties().instanceCount(); + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withInstanceCount(Integer instanceCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withInstanceCount(instanceCount); + return this; + } + + /** + * Get the serviceType property: ServiceType for the service. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.innerProperties() == null ? null : this.innerProperties().serviceType(); + } + + /** + * Set the serviceType property: ServiceType for the service. + * + * @param serviceType the serviceType value to set. + * @return the ServiceResourceCreateUpdateParameters object itself. + */ + public ServiceResourceCreateUpdateParameters withServiceType(ServiceType serviceType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceCreateUpdateProperties(); + } + this.innerProperties().withServiceType(serviceType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java new file mode 100644 index 0000000000000..5ec1937690bc2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ServiceResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Service Resource and their properties. */ +@Immutable +public final class ServiceResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceListResult.class); + + /* + * List of Service Resource and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Service Resource and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceProperties.java new file mode 100644 index 0000000000000..36e635eb409d5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceResourceProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Services response resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "serviceType", + defaultImpl = ServiceResourceProperties.class) +@JsonTypeName("ServiceResourceProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "DataTransfer", value = DataTransferServiceResourceProperties.class), + @JsonSubTypes.Type(name = "SqlDedicatedGateway", value = SqlDedicatedGatewayServiceResourceProperties.class), + @JsonSubTypes.Type(name = "GraphAPICompute", value = GraphApiComputeServiceResourceProperties.class) +}) +@Fluent +public class ServiceResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceProperties.class); + + /* + * Time of the last state change (ISO-8601 format). + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * Instance type for the service. + */ + @JsonProperty(value = "instanceSize") + private ServiceSize instanceSize; + + /* + * Instance count for the service. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /* + * Describes the status of a service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ServiceStatus status; + + /* + * Services response resource. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the creationTime property: Time of the last state change (ISO-8601 format). + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Get the instanceSize property: Instance type for the service. + * + * @return the instanceSize value. + */ + public ServiceSize instanceSize() { + return this.instanceSize; + } + + /** + * Set the instanceSize property: Instance type for the service. + * + * @param instanceSize the instanceSize value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + this.instanceSize = instanceSize; + return this; + } + + /** + * Get the instanceCount property: Instance count for the service. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: Instance count for the service. + * + * @param instanceCount the instanceCount value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Get the status property: Describes the status of a service. + * + * @return the status value. + */ + public ServiceStatus status() { + return this.status; + } + + /** + * Get the additionalProperties property: Services response resource. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Services response resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java new file mode 100644 index 0000000000000..b79f887e8604d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceSize.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServiceSize. */ +public final class ServiceSize extends ExpandableStringEnum { + /** Static value Cosmos.D4s for ServiceSize. */ + public static final ServiceSize COSMOS_D4S = fromString("Cosmos.D4s"); + + /** Static value Cosmos.D8s for ServiceSize. */ + public static final ServiceSize COSMOS_D8S = fromString("Cosmos.D8s"); + + /** Static value Cosmos.D16s for ServiceSize. */ + public static final ServiceSize COSMOS_D16S = fromString("Cosmos.D16s"); + + /** + * Creates or finds a ServiceSize from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceSize. + */ + @JsonCreator + public static ServiceSize fromString(String name) { + return fromString(name, ServiceSize.class); + } + + /** @return known ServiceSize values. */ + public static Collection values() { + return values(ServiceSize.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceStatus.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceStatus.java new file mode 100644 index 0000000000000..aa7643c3cf54b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceStatus.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServiceStatus. */ +public final class ServiceStatus extends ExpandableStringEnum { + /** Static value Creating for ServiceStatus. */ + public static final ServiceStatus CREATING = fromString("Creating"); + + /** Static value Running for ServiceStatus. */ + public static final ServiceStatus RUNNING = fromString("Running"); + + /** Static value Updating for ServiceStatus. */ + public static final ServiceStatus UPDATING = fromString("Updating"); + + /** Static value Deleting for ServiceStatus. */ + public static final ServiceStatus DELETING = fromString("Deleting"); + + /** Static value Error for ServiceStatus. */ + public static final ServiceStatus ERROR = fromString("Error"); + + /** Static value Stopped for ServiceStatus. */ + public static final ServiceStatus STOPPED = fromString("Stopped"); + + /** + * Creates or finds a ServiceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceStatus. + */ + @JsonCreator + public static ServiceStatus fromString(String name) { + return fromString(name, ServiceStatus.class); + } + + /** @return known ServiceStatus values. */ + public static Collection values() { + return values(ServiceStatus.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceType.java new file mode 100644 index 0000000000000..8e164890ef198 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ServiceType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServiceType. */ +public final class ServiceType extends ExpandableStringEnum { + /** Static value SqlDedicatedGateway for ServiceType. */ + public static final ServiceType SQL_DEDICATED_GATEWAY = fromString("SqlDedicatedGateway"); + + /** Static value DataTransfer for ServiceType. */ + public static final ServiceType DATA_TRANSFER = fromString("DataTransfer"); + + /** Static value GraphAPICompute for ServiceType. */ + public static final ServiceType GRAPH_APICOMPUTE = fromString("GraphAPICompute"); + + /** + * Creates or finds a ServiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceType. + */ + @JsonCreator + public static ServiceType fromString(String name) { + return fromString(name, ServiceType.class); + } + + /** @return known ServiceType values. */ + public static Collection values() { + return values(ServiceType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Services.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Services.java new file mode 100644 index 0000000000000..30486ba9339bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Services.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Services. */ +public interface Services { + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + PagedIterable list(String resourceGroupName, String accountName, Context context); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + ServiceResource get(String resourceGroupName, String accountName, String serviceName); + + /** + * Gets the status of service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String serviceName, Context context); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String serviceName); + + /** + * Deletes service with the given serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param serviceName Cosmos DB service name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String serviceName, Context context); + + /** + * Gets the status of service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + ServiceResource getById(String id); + + /** + * Gets the status of service. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of service. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes service with the given serviceName. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes service with the given serviceName. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServiceResource resource. + * + * @param name resource name. + * @return the first stage of the new ServiceResource definition. + */ + ServiceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java new file mode 100644 index 0000000000000..bb1cfd229b656 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialSpec.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SpatialSpec model. */ +@Fluent +public final class SpatialSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpatialSpec.class); + + /* + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*) + */ + @JsonProperty(value = "path") + private String path; + + /* + * List of path's spatial type + */ + @JsonProperty(value = "types") + private List types; + + /** + * Get the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path for which the indexing behavior applies to. Index paths typically start with root + * and end with wildcard (/path/*). + * + * @param path the path value to set. + * @return the SpatialSpec object itself. + */ + public SpatialSpec withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the types property: List of path's spatial type. + * + * @return the types value. + */ + public List types() { + return this.types; + } + + /** + * Set the types property: List of path's spatial type. + * + * @param types the types value to set. + * @return the SpatialSpec object itself. + */ + public SpatialSpec withTypes(List types) { + this.types = types; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java new file mode 100644 index 0000000000000..89cf5f5018fc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SpatialType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SpatialType. */ +public final class SpatialType extends ExpandableStringEnum { + /** Static value Point for SpatialType. */ + public static final SpatialType POINT = fromString("Point"); + + /** Static value LineString for SpatialType. */ + public static final SpatialType LINE_STRING = fromString("LineString"); + + /** Static value Polygon for SpatialType. */ + public static final SpatialType POLYGON = fromString("Polygon"); + + /** Static value MultiPolygon for SpatialType. */ + public static final SpatialType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a SpatialType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpatialType. + */ + @JsonCreator + public static SpatialType fromString(String name) { + return fromString(name, SpatialType.class); + } + + /** @return known SpatialType values. */ + public static Collection values() { + return values(SpatialType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java new file mode 100644 index 0000000000000..f4482fa7dc1ee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB container. */ +@Fluent +public final class SqlContainerCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB container. + */ + @JsonProperty(value = "properties", required = true) + private SqlContainerCreateUpdateProperties innerProperties = new SqlContainerCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB container. + * + * @return the innerProperties value. + */ + private SqlContainerCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a container. + * + * @return the resource value. + */ + public SqlContainerResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a container. + * + * @param resource the resource value to set. + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withResource(SqlContainerResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlContainerCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlContainerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java new file mode 100644 index 0000000000000..0ea1a5ceffafd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlContainerGetPropertiesOptions model. */ +@Fluent +public final class SqlContainerGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java new file mode 100644 index 0000000000000..8b4aa7dd18169 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetPropertiesResource.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlContainerGetPropertiesResource model. */ +@Fluent +public final class SqlContainerGetPropertiesResource extends SqlContainerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + super.withIndexingPolicy(indexingPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + super.withPartitionKey(partitionKey); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + super.withDefaultTtl(defaultTtl); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + super.withUniqueKeyPolicy(uniqueKeyPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withConflictResolutionPolicy( + ConflictResolutionPolicy conflictResolutionPolicy) { + super.withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlContainerGetPropertiesResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + super.withAnalyticalStorageTtl(analyticalStorageTtl); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java new file mode 100644 index 0000000000000..f22bdbf3e76e2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerGetResults.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of SqlContainerGetResults. */ +public interface SqlContainerGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + SqlContainerGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + SqlContainerGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner object. + * + * @return the inner object. + */ + SqlContainerGetResultsInner innerModel(); + + /** The entirety of the SqlContainerGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The SqlContainerGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlContainerGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlContainerGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlContainerGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingSqlDatabase(String resourceGroupName, String accountName, String databaseName); + } + /** The stage of the SqlContainerGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a container. + * + * @param resource The standard JSON format of a container. + * @return the next definition stage. + */ + WithCreate withResource(SqlContainerResource resource); + } + /** + * The stage of the SqlContainerGetResults definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlContainerGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlContainerGetResults create(Context context); + } + /** The stage of the SqlContainerGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlContainerGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlContainerGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the SqlContainerGetResults resource. + * + * @return the stage of resource update. + */ + SqlContainerGetResults.Update update(); + + /** The template for SqlContainerGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlContainerGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlContainerGetResults apply(Context context); + } + /** The SqlContainerGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlContainerGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlContainerGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlContainerGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a container. + * + * @param resource The standard JSON format of a container. + * @return the next definition stage. + */ + Update withResource(SqlContainerResource resource); + } + /** The stage of the SqlContainerGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlContainerGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlContainerGetResults refresh(Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @param location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation(ContinuousBackupRestoreLocation location, Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.java new file mode 100644 index 0000000000000..f8d612e8d32de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlContainerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the containers and their properties. */ +@Immutable +public final class SqlContainerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerListResult.class); + + /* + * List of containers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of containers and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java new file mode 100644 index 0000000000000..6773dd72cefee --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlContainerResource.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL container resource object. */ +@Fluent +public class SqlContainerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlContainerResource.class); + + /* + * Name of the Cosmos DB SQL container + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the container + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /* + * The configuration of the partition key to be used for partitioning data + * into multiple partitions + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /* + * Default time to live + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /* + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /* + * The conflict resolution policy for the container. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /* + * Analytical TTL. + */ + @JsonProperty(value = "analyticalStorageTtl") + private Long analyticalStorageTtl; + + /** + * Get the id property: Name of the Cosmos DB SQL container. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL container. + * + * @param id the id value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the container. + * + * @return the indexingPolicy value. + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the indexingPolicy property: The configuration of the indexing policy. By default, the indexing is automatic + * for all document paths within the container. + * + * @param indexingPolicy the indexingPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @return the partitionKey value. + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the partitionKey property: The configuration of the partition key to be used for partitioning data into + * multiple partitions. + * + * @param partitionKey the partitionKey value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get the defaultTtl property: Default time to live. + * + * @return the defaultTtl value. + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set the defaultTtl property: Default time to live. + * + * @param defaultTtl the defaultTtl value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value. + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the uniqueKeyPolicy property: The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflictResolutionPolicy property: The conflict resolution policy for the container. + * + * @return the conflictResolutionPolicy value. + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: The conflict resolution policy for the container. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get the analyticalStorageTtl property: Analytical TTL. + * + * @return the analyticalStorageTtl value. + */ + public Long analyticalStorageTtl() { + return this.analyticalStorageTtl; + } + + /** + * Set the analyticalStorageTtl property: Analytical TTL. + * + * @param analyticalStorageTtl the analyticalStorageTtl value to set. + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withAnalyticalStorageTtl(Long analyticalStorageTtl) { + this.analyticalStorageTtl = analyticalStorageTtl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlContainerResource")); + } + if (indexingPolicy() != null) { + indexingPolicy().validate(); + } + if (partitionKey() != null) { + partitionKey().validate(); + } + if (uniqueKeyPolicy() != null) { + uniqueKeyPolicy().validate(); + } + if (conflictResolutionPolicy() != null) { + conflictResolutionPolicy().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..224705f78db6b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB SQL database. */ +@Fluent +public final class SqlDatabaseCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB SQL database. + */ + @JsonProperty(value = "properties", required = true) + private SqlDatabaseCreateUpdateProperties innerProperties = new SqlDatabaseCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB SQL database. + * + * @return the innerProperties value. + */ + private SqlDatabaseCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a SQL database. + * + * @return the resource value. + */ + public SqlDatabaseResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a SQL database. + * + * @param resource the resource value to set. + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withResource(SqlDatabaseResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlDatabaseCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlDatabaseCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java new file mode 100644 index 0000000000000..7e890f0515fde --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The SqlDatabaseGetPropertiesOptions model. */ +@Fluent +public final class SqlDatabaseGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..407f620fcceb0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetPropertiesResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlDatabaseGetPropertiesResource model. */ +@Fluent +public final class SqlDatabaseGetPropertiesResource extends SqlDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseGetPropertiesResource.class); + + /* + * A system generated property that specified the addressable path of the + * collections resource. + */ + @JsonProperty(value = "_colls") + private String colls; + + /* + * A system generated property that specifies the addressable path of the + * users resource. + */ + @JsonProperty(value = "_users") + private String users; + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @return the colls value. + */ + public String colls() { + return this.colls; + } + + /** + * Set the colls property: A system generated property that specified the addressable path of the collections + * resource. + * + * @param colls the colls value to set. + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource withColls(String colls) { + this.colls = colls; + return this; + } + + /** + * Get the users property: A system generated property that specifies the addressable path of the users resource. + * + * @return the users value. + */ + public String users() { + return this.users; + } + + /** + * Set the users property: A system generated property that specifies the addressable path of the users resource. + * + * @param users the users value to set. + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource withUsers(String users) { + this.users = users; + return this; + } + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlDatabaseGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java new file mode 100644 index 0000000000000..141908f3aba64 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of SqlDatabaseGetResults. */ +public interface SqlDatabaseGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + SqlDatabaseGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + SqlDatabaseGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner object. + * + * @return the inner object. + */ + SqlDatabaseGetResultsInner innerModel(); + + /** The entirety of the SqlDatabaseGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The SqlDatabaseGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlDatabaseGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a SQL database. + * + * @param resource The standard JSON format of a SQL database. + * @return the next definition stage. + */ + WithCreate withResource(SqlDatabaseResource resource); + } + /** + * The stage of the SqlDatabaseGetResults definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlDatabaseGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlDatabaseGetResults create(Context context); + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlDatabaseGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the SqlDatabaseGetResults resource. + * + * @return the stage of resource update. + */ + SqlDatabaseGetResults.Update update(); + + /** The template for SqlDatabaseGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlDatabaseGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlDatabaseGetResults apply(Context context); + } + /** The SqlDatabaseGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlDatabaseGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlDatabaseGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlDatabaseGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a SQL database. + * + * @param resource The standard JSON format of a SQL database. + * @return the next definition stage. + */ + Update withResource(SqlDatabaseResource resource); + } + /** The stage of the SqlDatabaseGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlDatabaseGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlDatabaseGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.java new file mode 100644 index 0000000000000..1c23a3e95608d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlDatabaseGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the SQL databases and their properties. */ +@Immutable +public final class SqlDatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseListResult.class); + + /* + * List of SQL databases and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of SQL databases and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java new file mode 100644 index 0000000000000..9f4a67e381a09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDatabaseResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL database resource object. */ +@Fluent +public class SqlDatabaseResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDatabaseResource.class); + + /* + * Name of the Cosmos DB SQL database + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB SQL database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL database. + * + * @param id the id value to set. + * @return the SqlDatabaseResource object itself. + */ + public SqlDatabaseResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlDatabaseResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayRegionalServiceResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayRegionalServiceResource.java new file mode 100644 index 0000000000000..a8ffa27ea1962 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayRegionalServiceResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource for a regional service location. */ +@Immutable +public final class SqlDedicatedGatewayRegionalServiceResource extends RegionalServiceResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlDedicatedGatewayRegionalServiceResource.class); + + /* + * The regional endpoint for SqlDedicatedGateway. + */ + @JsonProperty(value = "sqlDedicatedGatewayEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String sqlDedicatedGatewayEndpoint; + + /** + * Get the sqlDedicatedGatewayEndpoint property: The regional endpoint for SqlDedicatedGateway. + * + * @return the sqlDedicatedGatewayEndpoint value. + */ + public String sqlDedicatedGatewayEndpoint() { + return this.sqlDedicatedGatewayEndpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java new file mode 100644 index 0000000000000..ecebc6f59dcb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlDedicatedGatewayServiceResourceProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties for SqlDedicatedGatewayServiceResource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "serviceType") +@JsonTypeName("SqlDedicatedGateway") +@Fluent +public final class SqlDedicatedGatewayServiceResourceProperties extends ServiceResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SqlDedicatedGatewayServiceResourceProperties.class); + + /* + * SqlDedicatedGateway endpoint for the service. + */ + @JsonProperty(value = "sqlDedicatedGatewayEndpoint") + private String sqlDedicatedGatewayEndpoint; + + /* + * An array that contains all of the locations for the service. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * Get the sqlDedicatedGatewayEndpoint property: SqlDedicatedGateway endpoint for the service. + * + * @return the sqlDedicatedGatewayEndpoint value. + */ + public String sqlDedicatedGatewayEndpoint() { + return this.sqlDedicatedGatewayEndpoint; + } + + /** + * Set the sqlDedicatedGatewayEndpoint property: SqlDedicatedGateway endpoint for the service. + * + * @param sqlDedicatedGatewayEndpoint the sqlDedicatedGatewayEndpoint value to set. + * @return the SqlDedicatedGatewayServiceResourceProperties object itself. + */ + public SqlDedicatedGatewayServiceResourceProperties withSqlDedicatedGatewayEndpoint( + String sqlDedicatedGatewayEndpoint) { + this.sqlDedicatedGatewayEndpoint = sqlDedicatedGatewayEndpoint; + return this; + } + + /** + * Get the locations property: An array that contains all of the locations for the service. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** {@inheritDoc} */ + @Override + public SqlDedicatedGatewayServiceResourceProperties withInstanceSize(ServiceSize instanceSize) { + super.withInstanceSize(instanceSize); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlDedicatedGatewayServiceResourceProperties withInstanceCount(Integer instanceCount) { + super.withInstanceCount(instanceCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java new file mode 100644 index 0000000000000..1046b131439af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlResources.java @@ -0,0 +1,1342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlResources. */ +public interface SqlResources { + /** + * Lists the SQL databases 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + PagedIterable listSqlDatabases(String resourceGroupName, String accountName); + + /** + * Lists the SQL databases 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the SQL databases and their properties. + */ + PagedIterable listSqlDatabases( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + SqlDatabaseGetResults getSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + Response getSqlDatabaseWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Gets the RUs per second of the SQL database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + ThroughputSettingsGetResults getSqlDatabaseThroughput( + String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the SQL database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the + * provided name. + */ + Response getSqlDatabaseThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlDatabaseThroughput( + String resourceGroupName, + String accountName, + String databaseName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToAutoscale( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlDatabaseToManualThroughput( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the containers and their properties. + */ + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the containers and their properties. + */ + PagedIterable listSqlContainers( + String resourceGroupName, String accountName, String databaseName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + SqlContainerGetResults getSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainer( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + ThroughputSettingsGetResults getSqlContainerThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerThroughputWithResponse( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateSqlContainerThroughput( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToAutoscale( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateSqlContainerToManualThroughput( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Lists the SQL storedProcedure 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL storedProcedure 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the storedProcedures and their properties. + */ + PagedIterable listSqlStoredProcedures( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + SqlStoredProcedureGetResults getSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Gets the SQL storedProcedure 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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + Response getSqlStoredProcedureWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @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 storedProcedureName Cosmos DB storedProcedure name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedure( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String storedProcedureName, + Context context); + + /** + * Lists the SQL userDefinedFunction 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL userDefinedFunction 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the userDefinedFunctions and their properties. + */ + PagedIterable listSqlUserDefinedFunctions( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + SqlUserDefinedFunctionGetResults getSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Gets the SQL userDefinedFunction 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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + Response getSqlUserDefinedFunctionWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @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 userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunction( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String userDefinedFunctionName, + Context context); + + /** + * Lists the SQL trigger 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 com.azure.core.management.exception.ManagementException 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 operation response, that contains the triggers and their properties. + */ + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL trigger 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the triggers and their properties. + */ + PagedIterable listSqlTriggers( + String resourceGroupName, String accountName, String databaseName, String containerName, Context context); + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + SqlTriggerGetResults getSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Gets the SQL trigger 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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + Response getSqlTriggerWithResponse( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTrigger( + String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @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 triggerName Cosmos DB trigger name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTrigger( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + String triggerName, + Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + SqlRoleDefinitionGetResults getSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + Response getSqlRoleDefinitionWithResponse( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinition(String roleDefinitionId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param roleDefinitionId The GUID for the Role Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinition( + String roleDefinitionId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + PagedIterable listSqlRoleDefinitions(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Definitions. + */ + PagedIterable listSqlRoleDefinitions( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + SqlRoleAssignmentGetResults getSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + Response getSqlRoleAssignmentWithResponse( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignment(String roleAssignmentId, String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param roleAssignmentId The GUID for the Role Assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignment( + String roleAssignmentId, String resourceGroupName, String accountName, Context context); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + PagedIterable listSqlRoleAssignments(String resourceGroupName, String accountName); + + /** + * Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the relevant Role Assignments. + */ + PagedIterable listSqlRoleAssignments( + String resourceGroupName, String accountName, Context context); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location); + + /** + * Retrieves continuous backup information for a container resource. + * + * @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 location The name of the continuous backup restore location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup information of a resource. + */ + BackupInformation retrieveContinuousBackupInformation( + String resourceGroupName, + String accountName, + String databaseName, + String containerName, + ContinuousBackupRestoreLocation location, + Context context); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + SqlDatabaseGetResults getSqlDatabaseById(String id); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL database under an existing Azure Cosmos DB database account with the provided name. + */ + Response getSqlDatabaseByIdWithResponse(String id, Context context); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + SqlContainerGetResults getSqlContainerById(String id); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL container under an existing Azure Cosmos DB database account. + */ + Response getSqlContainerByIdWithResponse(String id, Context context); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + SqlStoredProcedureGetResults getSqlStoredProcedureById(String id); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL storedProcedure under an existing Azure Cosmos DB database account. + */ + Response getSqlStoredProcedureByIdWithResponse(String id, Context context); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + SqlUserDefinedFunctionGetResults getSqlUserDefinedFunctionById(String id); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + */ + Response getSqlUserDefinedFunctionByIdWithResponse(String id, Context context); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + SqlTriggerGetResults getSqlTriggerById(String id); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SQL trigger under an existing Azure Cosmos DB database account. + */ + Response getSqlTriggerByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + SqlRoleDefinitionGetResults getSqlRoleDefinitionById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB SQL Role Definition. + */ + Response getSqlRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + SqlRoleAssignmentGetResults getSqlRoleAssignmentById(String id); + + /** + * Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB Role Assignment. + */ + Response getSqlRoleAssignmentByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabaseById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlDatabaseByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainerById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlContainerByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedureById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlStoredProcedureByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunctionById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlUserDefinedFunctionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTriggerById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlTriggerByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinitionById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleDefinitionByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignmentById(String id); + + /** + * Deletes an existing Azure Cosmos DB SQL Role Assignment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteSqlRoleAssignmentByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlDatabaseGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlDatabaseGetResults definition. + */ + SqlDatabaseGetResults.DefinitionStages.Blank defineUpdateSqlDatabase(String name); + + /** + * Begins definition for a new SqlContainerGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlContainerGetResults definition. + */ + SqlContainerGetResults.DefinitionStages.Blank defineUpdateSqlContainer(String name); + + /** + * Begins definition for a new SqlStoredProcedureGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlStoredProcedureGetResults definition. + */ + SqlStoredProcedureGetResults.DefinitionStages.Blank defineUpdateSqlStoredProcedure(String name); + + /** + * Begins definition for a new SqlUserDefinedFunctionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlUserDefinedFunctionGetResults definition. + */ + SqlUserDefinedFunctionGetResults.DefinitionStages.Blank defineUpdateSqlUserDefinedFunction(String name); + + /** + * Begins definition for a new SqlTriggerGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlTriggerGetResults definition. + */ + SqlTriggerGetResults.DefinitionStages.Blank defineUpdateSqlTrigger(String name); + + /** + * Begins definition for a new SqlRoleDefinitionGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlRoleDefinitionGetResults definition. + */ + SqlRoleDefinitionGetResults.DefinitionStages.Blank defineUpdateSqlRoleDefinition(String name); + + /** + * Begins definition for a new SqlRoleAssignmentGetResults resource. + * + * @param name resource name. + * @return the first stage of the new SqlRoleAssignmentGetResults definition. + */ + SqlRoleAssignmentGetResults.DefinitionStages.Blank defineUpdateSqlRoleAssignment(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java new file mode 100644 index 0000000000000..1a064b6c25188 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentCreateUpdateParameters.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Assignment. */ +@Fluent +public final class SqlRoleAssignmentCreateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentCreateUpdateParameters.class); + + /* + * Properties to create and update an Azure Cosmos DB SQL Role Assignment. + */ + @JsonProperty(value = "properties") + private SqlRoleAssignmentResource innerProperties; + + /** + * Get the innerProperties property: Properties to create and update an Azure Cosmos DB SQL Role Assignment. + * + * @return the innerProperties value. + */ + private SqlRoleAssignmentResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().roleDefinitionId(); + } + + /** + * Set the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters withRoleDefinitionId(String roleDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withRoleDefinitionId(roleDefinitionId); + return this; + } + + /** + * Get the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @param scope the scope value to set. + * @return the SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters withScope(String scope) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Set the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @param principalId the principalId value to set. + * @return the SqlRoleAssignmentCreateUpdateParameters object itself. + */ + public SqlRoleAssignmentCreateUpdateParameters withPrincipalId(String principalId) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleAssignmentResource(); + } + this.innerProperties().withPrincipalId(principalId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java new file mode 100644 index 0000000000000..9434a25a94ed9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentGetResults.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; + +/** An immutable client-side representation of SqlRoleAssignmentGetResults. */ +public interface SqlRoleAssignmentGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the roleDefinitionId property: The unique identifier for the associated Role Definition. + * + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * Gets the scope property: The data plane resource path for which access is being granted through this Role + * Assignment. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the principalId property: The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant + * associated with the subscription. + * + * @return the principalId value. + */ + String principalId(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner object. + * + * @return the inner object. + */ + SqlRoleAssignmentGetResultsInner innerModel(); + + /** The entirety of the SqlRoleAssignmentGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlRoleAssignmentGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlRoleAssignmentGetResults definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the SqlRoleAssignmentGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRoleDefinitionId, + DefinitionStages.WithScope, + DefinitionStages.WithPrincipalId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlRoleAssignmentGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlRoleAssignmentGetResults create(Context context); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The unique identifier for the associated Role Definition.. + * + * @param roleDefinitionId The unique identifier for the associated Role Definition. + * @return the next definition stage. + */ + WithCreate withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: The data plane resource path for which access is being granted through this + * Role Assignment.. + * + * @param scope The data plane resource path for which access is being granted through this Role Assignment. + * @return the next definition stage. + */ + WithCreate withScope(String scope); + } + /** The stage of the SqlRoleAssignmentGetResults definition allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: The unique identifier for the associated AAD principal in the AAD + * graph to which access is being granted through this Role Assignment. Tenant ID for the principal is + * inferred using the tenant associated with the subscription.. + * + * @param principalId The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using + * the tenant associated with the subscription. + * @return the next definition stage. + */ + WithCreate withPrincipalId(String principalId); + } + } + /** + * Begins update for the SqlRoleAssignmentGetResults resource. + * + * @return the stage of resource update. + */ + SqlRoleAssignmentGetResults.Update update(); + + /** The template for SqlRoleAssignmentGetResults update. */ + interface Update extends UpdateStages.WithRoleDefinitionId, UpdateStages.WithScope, UpdateStages.WithPrincipalId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlRoleAssignmentGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlRoleAssignmentGetResults apply(Context context); + } + /** The SqlRoleAssignmentGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The unique identifier for the associated Role Definition.. + * + * @param roleDefinitionId The unique identifier for the associated Role Definition. + * @return the next definition stage. + */ + Update withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify scope. */ + interface WithScope { + /** + * Specifies the scope property: The data plane resource path for which access is being granted through this + * Role Assignment.. + * + * @param scope The data plane resource path for which access is being granted through this Role Assignment. + * @return the next definition stage. + */ + Update withScope(String scope); + } + /** The stage of the SqlRoleAssignmentGetResults update allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: The unique identifier for the associated AAD principal in the AAD + * graph to which access is being granted through this Role Assignment. Tenant ID for the principal is + * inferred using the tenant associated with the subscription.. + * + * @param principalId The unique identifier for the associated AAD principal in the AAD graph to which + * access is being granted through this Role Assignment. Tenant ID for the principal is inferred using + * the tenant associated with the subscription. + * @return the next definition stage. + */ + Update withPrincipalId(String principalId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlRoleAssignmentGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlRoleAssignmentGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java new file mode 100644 index 0000000000000..522697e5354f4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleAssignmentListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleAssignmentGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Assignments. */ +@Immutable +public final class SqlRoleAssignmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleAssignmentListResult.class); + + /* + * List of Role Assignments and their properties + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Role Assignments and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java new file mode 100644 index 0000000000000..0690f705243e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionCreateUpdateParameters.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters to create and update an Azure Cosmos DB SQL Role Definition. */ +@Fluent +public final class SqlRoleDefinitionCreateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionCreateUpdateParameters.class); + + /* + * Properties to create and update an Azure Cosmos DB SQL Role Definition. + */ + @JsonProperty(value = "properties") + private SqlRoleDefinitionResource innerProperties; + + /** + * Get the innerProperties property: Properties to create and update an Azure Cosmos DB SQL Role Definition. + * + * @return the innerProperties value. + */ + private SqlRoleDefinitionResource innerProperties() { + return this.innerProperties; + } + + /** + * Get the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @return the roleName value. + */ + public String roleName() { + return this.innerProperties() == null ? null : this.innerProperties().roleName(); + } + + /** + * Set the roleName property: A user-friendly name for the Role Definition. Must be unique for the database account. + * + * @param roleName the roleName value to set. + * @return the SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters withRoleName(String roleName) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withRoleName(roleName); + return this; + } + + /** + * Get the type property: Indicates whether the Role Definition was built-in or user created. + * + * @return the type value. + */ + public RoleDefinitionType type() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Indicates whether the Role Definition was built-in or user created. + * + * @param type the type value to set. + * @return the SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters withType(RoleDefinitionType type) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + public List assignableScopes() { + return this.innerProperties() == null ? null : this.innerProperties().assignableScopes(); + } + + /** + * Set the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @param assignableScopes the assignableScopes value to set. + * @return the SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters withAssignableScopes(List assignableScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withAssignableScopes(assignableScopes); + return this; + } + + /** + * Get the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + public List permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The set of operations allowed through this Role Definition. + * + * @param permissions the permissions value to set. + * @return the SqlRoleDefinitionCreateUpdateParameters object itself. + */ + public SqlRoleDefinitionCreateUpdateParameters withPermissions(List permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlRoleDefinitionResource(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java new file mode 100644 index 0000000000000..2cbe897df257d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionGetResults.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import java.util.List; + +/** An immutable client-side representation of SqlRoleDefinitionGetResults. */ +public interface SqlRoleDefinitionGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the roleName property: A user-friendly name for the Role Definition. Must be unique for the database + * account. + * + * @return the roleName value. + */ + String roleName(); + + /** + * Gets the typePropertiesType property: Indicates whether the Role Definition was built-in or user created. + * + * @return the typePropertiesType value. + */ + RoleDefinitionType typePropertiesType(); + + /** + * Gets the assignableScopes property: A set of fully qualified Scopes at or below which Role Assignments may be + * created using this Role Definition. This will allow application of this Role Definition on the entire database + * account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database + * account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not + * exist. + * + * @return the assignableScopes value. + */ + List assignableScopes(); + + /** + * Gets the permissions property: The set of operations allowed through this Role Definition. + * + * @return the permissions value. + */ + List permissions(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner object. + * + * @return the inner object. + */ + SqlRoleDefinitionGetResultsInner innerModel(); + + /** The entirety of the SqlRoleDefinitionGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlRoleDefinitionGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlRoleDefinitionGetResults definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the SqlRoleDefinitionGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRoleName, + DefinitionStages.WithType, + DefinitionStages.WithAssignableScopes, + DefinitionStages.WithPermissions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlRoleDefinitionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlRoleDefinitionGetResults create(Context context); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify roleName. */ + interface WithRoleName { + /** + * Specifies the roleName property: A user-friendly name for the Role Definition. Must be unique for the + * database account.. + * + * @param roleName A user-friendly name for the Role Definition. Must be unique for the database account. + * @return the next definition stage. + */ + WithCreate withRoleName(String roleName); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Indicates whether the Role Definition was built-in or user created.. + * + * @param type Indicates whether the Role Definition was built-in or user created. + * @return the next definition stage. + */ + WithCreate withType(RoleDefinitionType type); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify assignableScopes. */ + interface WithAssignableScopes { + /** + * Specifies the assignableScopes property: A set of fully qualified Scopes at or below which Role + * Assignments may be created using this Role Definition. This will allow application of this Role + * Definition on the entire database account or any underlying Database / Collection. Must have at least one + * element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that + * resources referenced in assignable Scopes need not exist.. + * + * @param assignableScopes A set of fully qualified Scopes at or below which Role Assignments may be created + * using this Role Definition. This will allow application of this Role Definition on the entire + * database account or any underlying Database / Collection. Must have at least one element. Scopes + * higher than Database account are not enforceable as assignable Scopes. Note that resources referenced + * in assignable Scopes need not exist. + * @return the next definition stage. + */ + WithCreate withAssignableScopes(List assignableScopes); + } + /** The stage of the SqlRoleDefinitionGetResults definition allowing to specify permissions. */ + interface WithPermissions { + /** + * Specifies the permissions property: The set of operations allowed through this Role Definition.. + * + * @param permissions The set of operations allowed through this Role Definition. + * @return the next definition stage. + */ + WithCreate withPermissions(List permissions); + } + } + /** + * Begins update for the SqlRoleDefinitionGetResults resource. + * + * @return the stage of resource update. + */ + SqlRoleDefinitionGetResults.Update update(); + + /** The template for SqlRoleDefinitionGetResults update. */ + interface Update + extends UpdateStages.WithRoleName, + UpdateStages.WithType, + UpdateStages.WithAssignableScopes, + UpdateStages.WithPermissions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlRoleDefinitionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlRoleDefinitionGetResults apply(Context context); + } + /** The SqlRoleDefinitionGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify roleName. */ + interface WithRoleName { + /** + * Specifies the roleName property: A user-friendly name for the Role Definition. Must be unique for the + * database account.. + * + * @param roleName A user-friendly name for the Role Definition. Must be unique for the database account. + * @return the next definition stage. + */ + Update withRoleName(String roleName); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Indicates whether the Role Definition was built-in or user created.. + * + * @param type Indicates whether the Role Definition was built-in or user created. + * @return the next definition stage. + */ + Update withType(RoleDefinitionType type); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify assignableScopes. */ + interface WithAssignableScopes { + /** + * Specifies the assignableScopes property: A set of fully qualified Scopes at or below which Role + * Assignments may be created using this Role Definition. This will allow application of this Role + * Definition on the entire database account or any underlying Database / Collection. Must have at least one + * element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that + * resources referenced in assignable Scopes need not exist.. + * + * @param assignableScopes A set of fully qualified Scopes at or below which Role Assignments may be created + * using this Role Definition. This will allow application of this Role Definition on the entire + * database account or any underlying Database / Collection. Must have at least one element. Scopes + * higher than Database account are not enforceable as assignable Scopes. Note that resources referenced + * in assignable Scopes need not exist. + * @return the next definition stage. + */ + Update withAssignableScopes(List assignableScopes); + } + /** The stage of the SqlRoleDefinitionGetResults update allowing to specify permissions. */ + interface WithPermissions { + /** + * Specifies the permissions property: The set of operations allowed through this Role Definition.. + * + * @param permissions The set of operations allowed through this Role Definition. + * @return the next definition stage. + */ + Update withPermissions(List permissions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlRoleDefinitionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlRoleDefinitionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java new file mode 100644 index 0000000000000..767dd8deb4c2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlRoleDefinitionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlRoleDefinitionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The relevant Role Definitions. */ +@Immutable +public final class SqlRoleDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlRoleDefinitionListResult.class); + + /* + * List of Role Definitions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Role Definitions and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java new file mode 100644 index 0000000000000..c8d88ed356767 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB storedProcedure. */ +@Fluent +public final class SqlStoredProcedureCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB storedProcedure. + */ + @JsonProperty(value = "properties", required = true) + private SqlStoredProcedureCreateUpdateProperties innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB storedProcedure. + * + * @return the innerProperties value. + */ + private SqlStoredProcedureCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a storedProcedure. + * + * @return the resource value. + */ + public SqlStoredProcedureResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a storedProcedure. + * + * @param resource the resource value to set. + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withResource(SqlStoredProcedureResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlStoredProcedureCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlStoredProcedureCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java new file mode 100644 index 0000000000000..75fd730af27e9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlStoredProcedureGetPropertiesResource model. */ +@Fluent +public final class SqlStoredProcedureGetPropertiesResource extends SqlStoredProcedureResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlStoredProcedureGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java new file mode 100644 index 0000000000000..cbb1b521132cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureGetResults.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of SqlStoredProcedureGetResults. */ +public interface SqlStoredProcedureGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + SqlStoredProcedureGetPropertiesResource resource(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner object. + * + * @return the inner object. + */ + SqlStoredProcedureGetResultsInner innerModel(); + + /** The entirety of the SqlStoredProcedureGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The SqlStoredProcedureGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlStoredProcedureGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a storedProcedure. + * + * @param resource The standard JSON format of a storedProcedure. + * @return the next definition stage. + */ + WithCreate withResource(SqlStoredProcedureResource resource); + } + /** + * The stage of the SqlStoredProcedureGetResults definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlStoredProcedureGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlStoredProcedureGetResults create(Context context); + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlStoredProcedureGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the SqlStoredProcedureGetResults resource. + * + * @return the stage of resource update. + */ + SqlStoredProcedureGetResults.Update update(); + + /** The template for SqlStoredProcedureGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlStoredProcedureGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlStoredProcedureGetResults apply(Context context); + } + /** The SqlStoredProcedureGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlStoredProcedureGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlStoredProcedureGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlStoredProcedureGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a storedProcedure. + * + * @param resource The standard JSON format of a storedProcedure. + * @return the next definition stage. + */ + Update withResource(SqlStoredProcedureResource resource); + } + /** The stage of the SqlStoredProcedureGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlStoredProcedureGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlStoredProcedureGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.java new file mode 100644 index 0000000000000..3362a3bfec160 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlStoredProcedureGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the storedProcedures and their properties. */ +@Immutable +public final class SqlStoredProcedureListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureListResult.class); + + /* + * List of storedProcedures and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of storedProcedures and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java new file mode 100644 index 0000000000000..4b2444de4e953 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlStoredProcedureResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL storedProcedure resource object. */ +@Fluent +public class SqlStoredProcedureResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlStoredProcedureResource.class); + + /* + * Name of the Cosmos DB SQL storedProcedure + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Stored Procedure + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get the id property: Name of the Cosmos DB SQL storedProcedure. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL storedProcedure. + * + * @param id the id value to set. + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the Stored Procedure. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the Stored Procedure. + * + * @param body the body value to set. + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlStoredProcedureResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java new file mode 100644 index 0000000000000..ddf328d0e285f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB trigger. */ +@Fluent +public final class SqlTriggerCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB trigger. + */ + @JsonProperty(value = "properties", required = true) + private SqlTriggerCreateUpdateProperties innerProperties = new SqlTriggerCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB trigger. + * + * @return the innerProperties value. + */ + private SqlTriggerCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a trigger. + * + * @return the resource value. + */ + public SqlTriggerResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a trigger. + * + * @param resource the resource value to set. + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withResource(SqlTriggerResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlTriggerCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SqlTriggerCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java new file mode 100644 index 0000000000000..52d6e9dc6fc2c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetPropertiesResource.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlTriggerGetPropertiesResource model. */ +@Fluent +public final class SqlTriggerGetPropertiesResource extends SqlTriggerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withTriggerType(TriggerType triggerType) { + super.withTriggerType(triggerType); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlTriggerGetPropertiesResource withTriggerOperation(TriggerOperation triggerOperation) { + super.withTriggerOperation(triggerOperation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java new file mode 100644 index 0000000000000..22421170eab01 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerGetResults.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of SqlTriggerGetResults. */ +public interface SqlTriggerGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + SqlTriggerGetPropertiesResource resource(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner object. + * + * @return the inner object. + */ + SqlTriggerGetResultsInner innerModel(); + + /** The entirety of the SqlTriggerGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The SqlTriggerGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlTriggerGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlTriggerGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlTriggerGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + } + /** The stage of the SqlTriggerGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a trigger. + * + * @param resource The standard JSON format of a trigger. + * @return the next definition stage. + */ + WithCreate withResource(SqlTriggerResource resource); + } + /** + * The stage of the SqlTriggerGetResults definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlTriggerGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlTriggerGetResults create(Context context); + } + /** The stage of the SqlTriggerGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlTriggerGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlTriggerGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the SqlTriggerGetResults resource. + * + * @return the stage of resource update. + */ + SqlTriggerGetResults.Update update(); + + /** The template for SqlTriggerGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlTriggerGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlTriggerGetResults apply(Context context); + } + /** The SqlTriggerGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlTriggerGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlTriggerGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlTriggerGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a trigger. + * + * @param resource The standard JSON format of a trigger. + * @return the next definition stage. + */ + Update withResource(SqlTriggerResource resource); + } + /** The stage of the SqlTriggerGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlTriggerGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlTriggerGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.java new file mode 100644 index 0000000000000..ccd73cffe3ed6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlTriggerGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the triggers and their properties. */ +@Immutable +public final class SqlTriggerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerListResult.class); + + /* + * List of triggers and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of triggers and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java new file mode 100644 index 0000000000000..e858400486d4a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlTriggerResource.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL trigger resource object. */ +@Fluent +public class SqlTriggerResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTriggerResource.class); + + /* + * Name of the Cosmos DB SQL trigger + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the Trigger + */ + @JsonProperty(value = "body") + private String body; + + /* + * Type of the Trigger + */ + @JsonProperty(value = "triggerType") + private TriggerType triggerType; + + /* + * The operation the trigger is associated with + */ + @JsonProperty(value = "triggerOperation") + private TriggerOperation triggerOperation; + + /** + * Get the id property: Name of the Cosmos DB SQL trigger. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL trigger. + * + * @param id the id value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the Trigger. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the Trigger. + * + * @param body the body value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get the triggerType property: Type of the Trigger. + * + * @return the triggerType value. + */ + public TriggerType triggerType() { + return this.triggerType; + } + + /** + * Set the triggerType property: Type of the Trigger. + * + * @param triggerType the triggerType value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerType(TriggerType triggerType) { + this.triggerType = triggerType; + return this; + } + + /** + * Get the triggerOperation property: The operation the trigger is associated with. + * + * @return the triggerOperation value. + */ + public TriggerOperation triggerOperation() { + return this.triggerOperation; + } + + /** + * Set the triggerOperation property: The operation the trigger is associated with. + * + * @param triggerOperation the triggerOperation value to set. + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerOperation(TriggerOperation triggerOperation) { + this.triggerOperation = triggerOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SqlTriggerResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java new file mode 100644 index 0000000000000..26a4239e3e9b6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionCreateUpdateParameters.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB userDefinedFunction. */ +@Fluent +public final class SqlUserDefinedFunctionCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB userDefinedFunction. + */ + @JsonProperty(value = "properties", required = true) + private SqlUserDefinedFunctionCreateUpdateProperties innerProperties = + new SqlUserDefinedFunctionCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB userDefinedFunction. + * + * @return the innerProperties value. + */ + private SqlUserDefinedFunctionCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a userDefinedFunction. + * + * @return the resource value. + */ + public SqlUserDefinedFunctionResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource the resource value to set. + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withResource(SqlUserDefinedFunctionResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlUserDefinedFunctionCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model" + + " SqlUserDefinedFunctionCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java new file mode 100644 index 0000000000000..e22b7a53f0f33 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlUserDefinedFunctionGetPropertiesResource model. */ +@Fluent +public final class SqlUserDefinedFunctionGetPropertiesResource extends SqlUserDefinedFunctionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlUserDefinedFunctionGetPropertiesResource withBody(String body) { + super.withBody(body); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java new file mode 100644 index 0000000000000..a4bb24a1b114a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionGetResults.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of SqlUserDefinedFunctionGetResults. */ +public interface SqlUserDefinedFunctionGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + SqlUserDefinedFunctionGetPropertiesResource resource(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner + * object. + * + * @return the inner object. + */ + SqlUserDefinedFunctionGetResultsInner innerModel(); + + /** The entirety of the SqlUserDefinedFunctionGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The SqlUserDefinedFunctionGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlUserDefinedFunctionGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * + * @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. + * @return the next definition stage. + */ + WithResource withExistingContainer( + String resourceGroupName, String accountName, String databaseName, String containerName); + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource The standard JSON format of a userDefinedFunction. + * @return the next definition stage. + */ + WithCreate withResource(SqlUserDefinedFunctionResource resource); + } + /** + * The stage of the SqlUserDefinedFunctionGetResults definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlUserDefinedFunctionGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlUserDefinedFunctionGetResults create(Context context); + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlUserDefinedFunctionGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the SqlUserDefinedFunctionGetResults resource. + * + * @return the stage of resource update. + */ + SqlUserDefinedFunctionGetResults.Update update(); + + /** The template for SqlUserDefinedFunctionGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlUserDefinedFunctionGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlUserDefinedFunctionGetResults apply(Context context); + } + /** The SqlUserDefinedFunctionGetResults update stages. */ + interface UpdateStages { + /** The stage of the SqlUserDefinedFunctionGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the SqlUserDefinedFunctionGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the SqlUserDefinedFunctionGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a userDefinedFunction. + * + * @param resource The standard JSON format of a userDefinedFunction. + * @return the next definition stage. + */ + Update withResource(SqlUserDefinedFunctionResource resource); + } + /** The stage of the SqlUserDefinedFunctionGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlUserDefinedFunctionGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlUserDefinedFunctionGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.java new file mode 100644 index 0000000000000..84124f4d6ba05 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.SqlUserDefinedFunctionGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the userDefinedFunctions and their properties. */ +@Immutable +public final class SqlUserDefinedFunctionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionListResult.class); + + /* + * List of userDefinedFunctions and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of userDefinedFunctions and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java new file mode 100644 index 0000000000000..60d9a1bc51ebe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/SqlUserDefinedFunctionResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB SQL userDefinedFunction resource object. */ +@Fluent +public class SqlUserDefinedFunctionResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlUserDefinedFunctionResource.class); + + /* + * Name of the Cosmos DB SQL userDefinedFunction + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Body of the User Defined Function + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get the id property: Name of the Cosmos DB SQL userDefinedFunction. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB SQL userDefinedFunction. + * + * @param id the id value to set. + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the body property: Body of the User Defined Function. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Body of the User Defined Function. + * + * @param body the body value to set. + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model SqlUserDefinedFunctionResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java new file mode 100644 index 0000000000000..5af073737dcda --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableCreateUpdateParameters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableCreateUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to create and update Cosmos DB Table. */ +@Fluent +public final class TableCreateUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableCreateUpdateParameters.class); + + /* + * Properties to create and update Azure Cosmos DB Table. + */ + @JsonProperty(value = "properties", required = true) + private TableCreateUpdateProperties innerProperties = new TableCreateUpdateProperties(); + + /** + * Get the innerProperties property: Properties to create and update Azure Cosmos DB Table. + * + * @return the innerProperties value. + */ + private TableCreateUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableCreateUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a Table. + * + * @return the resource value. + */ + public TableResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a Table. + * + * @param resource the resource value to set. + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withResource(TableResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new TableCreateUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Get the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @return the options value. + */ + public CreateUpdateOptions options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: A key-value pair of options to be applied for the request. This corresponds to the + * headers sent with the request. + * + * @param options the options value to set. + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + if (this.innerProperties() == null) { + this.innerProperties = new TableCreateUpdateProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model TableCreateUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java new file mode 100644 index 0000000000000..acf1624c09131 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesOptions.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The TableGetPropertiesOptions model. */ +@Fluent +public final class TableGetPropertiesOptions extends OptionsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetPropertiesOptions.class); + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesOptions withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesOptions withAutoscaleSettings(AutoscaleSettings autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java new file mode 100644 index 0000000000000..b692785d6bfb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetPropertiesResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TableGetPropertiesResource model. */ +@Fluent +public final class TableGetPropertiesResource extends TableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public TableGetPropertiesResource withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java new file mode 100644 index 0000000000000..b4e88b0cb21ef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableGetResults.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of TableGetResults. */ +public interface TableGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + TableGetPropertiesResource resource(); + + /** + * Gets the options property: The options property. + * + * @return the options value. + */ + TableGetPropertiesOptions options(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner object. + * + * @return the inner object. + */ + TableGetResultsInner innerModel(); + + /** The entirety of the TableGetResults definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithResource, + DefinitionStages.WithCreate { + } + /** The TableGetResults definition stages. */ + interface DefinitionStages { + /** The first stage of the TableGetResults definition. */ + interface Blank extends WithLocation { + } + /** The stage of the TableGetResults definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the TableGetResults definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @return the next definition stage. + */ + WithResource withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + /** The stage of the TableGetResults definition allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Table. + * + * @param resource The standard JSON format of a Table. + * @return the next definition stage. + */ + WithCreate withResource(TableResource resource); + } + /** + * The stage of the TableGetResults definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + TableGetResults create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TableGetResults create(Context context); + } + /** The stage of the TableGetResults definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the TableGetResults definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the TableGetResults definition allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + WithCreate withOptions(CreateUpdateOptions options); + } + } + /** + * Begins update for the TableGetResults resource. + * + * @return the stage of resource update. + */ + TableGetResults.Update update(); + + /** The template for TableGetResults update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithResource, UpdateStages.WithOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TableGetResults apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TableGetResults apply(Context context); + } + /** The TableGetResults update stages. */ + interface UpdateStages { + /** The stage of the TableGetResults update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the TableGetResults update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the TableGetResults update allowing to specify resource. */ + interface WithResource { + /** + * Specifies the resource property: The standard JSON format of a Table. + * + * @param resource The standard JSON format of a Table. + * @return the next definition stage. + */ + Update withResource(TableResource resource); + } + /** The stage of the TableGetResults update allowing to specify options. */ + interface WithOptions { + /** + * Specifies the options property: A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request.. + * + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers + * sent with the request. + * @return the next definition stage. + */ + Update withOptions(CreateUpdateOptions options); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TableGetResults refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TableGetResults refresh(Context context); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java new file mode 100644 index 0000000000000..f7490c9913264 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.TableGetResultsInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List operation response, that contains the Table and their properties. */ +@Immutable +public final class TableListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableListResult.class); + + /* + * List of Table and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: List of Table and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java new file mode 100644 index 0000000000000..596dfb6db550a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB table resource object. */ +@Fluent +public class TableResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableResource.class); + + /* + * Name of the Cosmos DB table + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: Name of the Cosmos DB table. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Name of the Cosmos DB table. + * + * @param id the id value to set. + * @return the TableResource object itself. + */ + public TableResource withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model TableResource")); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java new file mode 100644 index 0000000000000..e7b799eb2e3bf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TableResources.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TableResources. */ +public interface TableResources { + /** + * Lists the Tables 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Table and their properties. + */ + PagedIterable listTables(String resourceGroupName, String accountName); + + /** + * Lists the Tables 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 operation response, that contains the Table and their properties. + */ + PagedIterable listTables(String resourceGroupName, String accountName, Context context); + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + TableGetResults getTable(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the Tables 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + Response getTableWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTable(String resourceGroupName, String accountName, String tableName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTable(String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + ThroughputSettingsGetResults getTableThroughput(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the RUs per second of the 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 tableName Cosmos DB table name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided + * name. + */ + Response getTableThroughputWithResponse( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @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 updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults updateTableThroughput( + String resourceGroupName, + String accountName, + String tableName, + ThroughputSettingsUpdateParameters updateThroughputParameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToAutoscale( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToManualThroughput( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Cosmos DB resource throughput. + */ + ThroughputSettingsGetResults migrateTableToManualThroughput( + String resourceGroupName, String accountName, String tableName, Context context); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + TableGetResults getTableById(String id); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Tables under an existing Azure Cosmos DB database account with the provided name. + */ + Response getTableByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTableById(String id); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteTableByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TableGetResults resource. + * + * @param name resource name. + * @return the first stage of the new TableGetResults definition. + */ + TableGetResults.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java new file mode 100644 index 0000000000000..bbdaa55240523 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputPolicyResource.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cosmos DB resource throughput policy. */ +@Fluent +public final class ThroughputPolicyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputPolicyResource.class); + + /* + * Determines whether the ThroughputPolicy is active or not + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + */ + @JsonProperty(value = "incrementPercent") + private Integer incrementPercent; + + /** + * Get the isEnabled property: Determines whether the ThroughputPolicy is active or not. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Determines whether the ThroughputPolicy is active or not. + * + * @param isEnabled the isEnabled value to set. + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the incrementPercent property: Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + * + * @return the incrementPercent value. + */ + public Integer incrementPercent() { + return this.incrementPercent; + } + + /** + * Set the incrementPercent property: Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + * + * @param incrementPercent the incrementPercent value to set. + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIncrementPercent(Integer incrementPercent) { + this.incrementPercent = incrementPercent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java new file mode 100644 index 0000000000000..6023879191447 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetPropertiesResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ThroughputSettingsGetPropertiesResource model. */ +@Fluent +public final class ThroughputSettingsGetPropertiesResource extends ThroughputSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsGetPropertiesResource.class); + + /* + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String rid; + + /* + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Float ts; + + /* + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the rid property: A system generated property. A unique identifier. + * + * @return the rid value. + */ + public String rid() { + return this.rid; + } + + /** + * Get the ts property: A system generated property that denotes the last updated timestamp of the resource. + * + * @return the ts value. + */ + public Float ts() { + return this.ts; + } + + /** + * Get the etag property: A system generated property representing the resource etag required for optimistic + * concurrency control. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withThroughput(Integer throughput) { + super.withThroughput(throughput); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsGetPropertiesResource withAutoscaleSettings(AutoscaleSettingsResource autoscaleSettings) { + super.withAutoscaleSettings(autoscaleSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java new file mode 100644 index 0000000000000..acc52203be425 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsGetResults.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner; +import java.util.Map; + +/** An immutable client-side representation of ThroughputSettingsGetResults. */ +public interface ThroughputSettingsGetResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the resource property: The resource property. + * + * @return the resource value. + */ + ThroughputSettingsGetPropertiesResource resource(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsGetResultsInner object. + * + * @return the inner object. + */ + ThroughputSettingsGetResultsInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java new file mode 100644 index 0000000000000..aefc58733ed17 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsResource.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. + */ +@Fluent +public class ThroughputSettingsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsResource.class); + + /* + * Value of the Cosmos DB resource throughput. Either throughput is + * required or autoscaleSettings is required, but not both. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /* + * Cosmos DB resource for autoscale settings. Either throughput is required + * or autoscaleSettings is required, but not both. + */ + @JsonProperty(value = "autoscaleSettings") + private AutoscaleSettingsResource autoscaleSettings; + + /* + * The minimum throughput of the resource + */ + @JsonProperty(value = "minimumThroughput", access = JsonProperty.Access.WRITE_ONLY) + private String minimumThroughput; + + /* + * The throughput replace is pending + */ + @JsonProperty(value = "offerReplacePending", access = JsonProperty.Access.WRITE_ONLY) + private String offerReplacePending; + + /** + * Get the throughput property: Value of the Cosmos DB resource throughput. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @return the throughput value. + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set the throughput property: Value of the Cosmos DB resource throughput. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @param throughput the throughput value to set. + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get the autoscaleSettings property: Cosmos DB resource for autoscale settings. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @return the autoscaleSettings value. + */ + public AutoscaleSettingsResource autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * Set the autoscaleSettings property: Cosmos DB resource for autoscale settings. Either throughput is required or + * autoscaleSettings is required, but not both. + * + * @param autoscaleSettings the autoscaleSettings value to set. + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withAutoscaleSettings(AutoscaleSettingsResource autoscaleSettings) { + this.autoscaleSettings = autoscaleSettings; + return this; + } + + /** + * Get the minimumThroughput property: The minimum throughput of the resource. + * + * @return the minimumThroughput value. + */ + public String minimumThroughput() { + return this.minimumThroughput; + } + + /** + * Get the offerReplacePending property: The throughput replace is pending. + * + * @return the offerReplacePending value. + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoscaleSettings() != null) { + autoscaleSettings().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java new file mode 100644 index 0000000000000..d9dfa06ecdcc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/ThroughputSettingsUpdateParameters.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.ThroughputSettingsUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters to update Cosmos DB resource throughput. */ +@Fluent +public final class ThroughputSettingsUpdateParameters extends ArmResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThroughputSettingsUpdateParameters.class); + + /* + * Properties to update Azure Cosmos DB resource throughput. + */ + @JsonProperty(value = "properties", required = true) + private ThroughputSettingsUpdateProperties innerProperties = new ThroughputSettingsUpdateProperties(); + + /** + * Get the innerProperties property: Properties to update Azure Cosmos DB resource throughput. + * + * @return the innerProperties value. + */ + private ThroughputSettingsUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThroughputSettingsUpdateParameters withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the resource property: The standard JSON format of a resource throughput. + * + * @return the resource value. + */ + public ThroughputSettingsResource resource() { + return this.innerProperties() == null ? null : this.innerProperties().resource(); + } + + /** + * Set the resource property: The standard JSON format of a resource throughput. + * + * @param resource the resource value to set. + * @return the ThroughputSettingsUpdateParameters object itself. + */ + public ThroughputSettingsUpdateParameters withResource(ThroughputSettingsResource resource) { + if (this.innerProperties() == null) { + this.innerProperties = new ThroughputSettingsUpdateProperties(); + } + this.innerProperties().withResource(resource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ThroughputSettingsUpdateParameters")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java new file mode 100644 index 0000000000000..ac6dec81a33e4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerOperation.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TriggerOperation. */ +public final class TriggerOperation extends ExpandableStringEnum { + /** Static value All for TriggerOperation. */ + public static final TriggerOperation ALL = fromString("All"); + + /** Static value Create for TriggerOperation. */ + public static final TriggerOperation CREATE = fromString("Create"); + + /** Static value Update for TriggerOperation. */ + public static final TriggerOperation UPDATE = fromString("Update"); + + /** Static value Delete for TriggerOperation. */ + public static final TriggerOperation DELETE = fromString("Delete"); + + /** Static value Replace for TriggerOperation. */ + public static final TriggerOperation REPLACE = fromString("Replace"); + + /** + * Creates or finds a TriggerOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerOperation. + */ + @JsonCreator + public static TriggerOperation fromString(String name) { + return fromString(name, TriggerOperation.class); + } + + /** @return known TriggerOperation values. */ + public static Collection values() { + return values(TriggerOperation.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java new file mode 100644 index 0000000000000..9b6b1526603fd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/TriggerType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TriggerType. */ +public final class TriggerType extends ExpandableStringEnum { + /** Static value Pre for TriggerType. */ + public static final TriggerType PRE = fromString("Pre"); + + /** Static value Post for TriggerType. */ + public static final TriggerType POST = fromString("Post"); + + /** + * Creates or finds a TriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerType. + */ + @JsonCreator + public static TriggerType fromString(String name) { + return fromString(name, TriggerType.class); + } + + /** @return known TriggerType values. */ + public static Collection values() { + return values(TriggerType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java new file mode 100644 index 0000000000000..64f8549280237 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKey.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + */ +@Fluent +public final class UniqueKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UniqueKey.class); + + /* + * List of paths must be unique for each document in the Azure Cosmos DB + * service + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Get the paths property: List of paths must be unique for each document in the Azure Cosmos DB service. + * + * @return the paths value. + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths property: List of paths must be unique for each document in the Azure Cosmos DB service. + * + * @param paths the paths value to set. + * @return the UniqueKey object itself. + */ + public UniqueKey withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java new file mode 100644 index 0000000000000..134f27c879b7e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UniqueKeyPolicy.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure + * Cosmos DB service. + */ +@Fluent +public final class UniqueKeyPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UniqueKeyPolicy.class); + + /* + * List of unique keys on that enforces uniqueness constraint on documents + * in the collection in the Azure Cosmos DB service. + */ + @JsonProperty(value = "uniqueKeys") + private List uniqueKeys; + + /** + * Get the uniqueKeys property: List of unique keys on that enforces uniqueness constraint on documents in the + * collection in the Azure Cosmos DB service. + * + * @return the uniqueKeys value. + */ + public List uniqueKeys() { + return this.uniqueKeys; + } + + /** + * Set the uniqueKeys property: List of unique keys on that enforces uniqueness constraint on documents in the + * collection in the Azure Cosmos DB service. + * + * @param uniqueKeys the uniqueKeys value to set. + * @return the UniqueKeyPolicy object itself. + */ + public UniqueKeyPolicy withUniqueKeys(List uniqueKeys) { + this.uniqueKeys = uniqueKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uniqueKeys() != null) { + uniqueKeys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java new file mode 100644 index 0000000000000..4a1b3530cea34 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UnitType.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnitType. */ +public final class UnitType extends ExpandableStringEnum { + /** Static value Count for UnitType. */ + public static final UnitType COUNT = fromString("Count"); + + /** Static value Bytes for UnitType. */ + public static final UnitType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitType. */ + public static final UnitType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitType. */ + public static final UnitType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Milliseconds for UnitType. */ + public static final UnitType MILLISECONDS = fromString("Milliseconds"); + + /** + * Creates or finds a UnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitType. + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** @return known UnitType values. */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java new file mode 100644 index 0000000000000..f19cb41736ea2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/Usage.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the inner com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java new file mode 100644 index 0000000000000..bd47b2e681361 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/UsagesResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cosmos.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list usage request. */ +@Immutable +public final class UsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesResult.class); + + /* + * The list of usages for the database. A usage is a point in time metric + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of usages for the database. A usage is a point in time metric. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..741e9c12a4df9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/VirtualNetworkRule.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual Network ACL Rule object. */ +@Fluent +public final class VirtualNetworkRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRule.class); + + /* + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVNetServiceEndpoint") + private Boolean ignoreMissingVNetServiceEndpoint; + + /** + * Get the id property: Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @param id the id value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ignoreMissingVNetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVNetServiceEndpoint value. + */ + public Boolean ignoreMissingVNetServiceEndpoint() { + return this.ignoreMissingVNetServiceEndpoint; + } + + /** + * Set the ignoreMissingVNetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVNetServiceEndpoint the ignoreMissingVNetServiceEndpoint value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVNetServiceEndpoint(Boolean ignoreMissingVNetServiceEndpoint) { + this.ignoreMissingVNetServiceEndpoint = ignoreMissingVNetServiceEndpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java new file mode 100644 index 0000000000000..824557a190c26 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider + * REST API. + */ +package com.azure.resourcemanager.cosmos.generated.models; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java new file mode 100644 index 0000000000000..562d43a115bc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/com/azure/resourcemanager/cosmos/generated/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for CosmosDBManagementClient. Azure Cosmos DB Database Service Resource Provider REST + * API. + */ +package com.azure.resourcemanager.cosmos.generated; diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..dae49a8d560d0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.cosmos.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.cosmos.generated; + exports com.azure.resourcemanager.cosmos.generated.fluent; + exports com.azure.resourcemanager.cosmos.generated.fluent.models; + exports com.azure.resourcemanager.cosmos.generated.models; + + opens com.azure.resourcemanager.cosmos.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.cosmos.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java new file mode 100644 index 0000000000000..44e35390099b0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersCreateUpdateSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.generated.models.Certificate; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters CreateUpdate. */ +public final class CassandraClustersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .define("cassandra-prod") + .withRegion("West US") + .withExistingResourceGroup("cassandra-prod-rg") + .withTags(mapOf()) + .withProperties( + new ClusterResourceProperties() + .withDelegatedManagementSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management") + .withCassandraVersion("3.11") + .withClusterNameOverride("ClusterNameIllegalForAzureResource") + .withAuthenticationMethod(AuthenticationMethod.CASSANDRA) + .withInitialCassandraAdminPassword("mypassword") + .withHoursBetweenBackups(24) + .withClientCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeleteSamples.java new file mode 100644 index 0000000000000..98ad8cce31e84 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Delete. */ +public final class CassandraClustersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().delete("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersFetchNodeStatusSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersFetchNodeStatusSamples.java new file mode 100644 index 0000000000000..985a3a1fb4db4 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersFetchNodeStatusSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters FetchNodeStatus. */ +public final class CassandraClustersFetchNodeStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterFetchNodeStatus.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterFetchNodeStatus. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterFetchNodeStatus( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().fetchNodeStatus("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetBackupSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetBackupSamples.java new file mode 100644 index 0000000000000..1b656aa7834c6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetBackupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters GetBackup. */ +public final class CassandraClustersGetBackupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraBackup.json + */ + /** + * Sample code: CosmosDBManagedCassandraBackup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraBackup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .getBackupWithResponse("cassandra-prod-rg", "cassandra-prod", "1611250348", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetByResourceGroupSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c38d27c9c2b10 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters GetByResourceGroup. */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().getByResourceGroupWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListBackupsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListBackupsSamples.java new file mode 100644 index 0000000000000..78d9d3925a726 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListBackupsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters ListBackups. */ +public final class CassandraClustersListBackupsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraBackupsList.json + */ + /** + * Sample code: CosmosDBManagedCassandraBackupsList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraBackupsList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().listBackups("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListByResourceGroupSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..10b842f1a8bbf --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters ListByResourceGroup. */ +public final class CassandraClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListByResourceGroup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterListByResourceGroup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().listByResourceGroup("cassandra-prod-rg", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListSamples.java new file mode 100644 index 0000000000000..21c60173f35bc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters List. */ +public final class CassandraClustersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListBySubscription. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterListBySubscription( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraClusters().list(Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersRequestRepairSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersRequestRepairSamples.java new file mode 100644 index 0000000000000..970afdfdc192c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersRequestRepairSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RepairPostBody; +import java.util.Arrays; + +/** Samples for CassandraClusters RequestRepair. */ +public final class CassandraClustersRequestRepairSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraRepair.json + */ + /** + * Sample code: CosmosDBManagedCassandraRepair. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraRepair( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraClusters() + .requestRepair( + "cassandra-prod-rg", + "cassandra-prod", + new RepairPostBody().withKeyspace("my-keyspace").withTables(Arrays.asList("table1", "table42")), + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersUpdateSamples.java new file mode 100644 index 0000000000000..fbb2cf8bf8505 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraClustersUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.generated.models.Certificate; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.generated.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters Update. */ +public final class CassandraClustersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraClusterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterPatch. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraClusterPatch( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + ClusterResource resource = + manager + .cassandraClusters() + .getByResourceGroupWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("owner", "mike")) + .withProperties( + new ClusterResourceProperties() + .withAuthenticationMethod(AuthenticationMethod.NONE) + .withHoursBetweenBackups(12) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4")))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersCreateUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersCreateUpdateSamples.java new file mode 100644 index 0000000000000..984434e9cc9de --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersCreateUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters CreateUpdate. */ +public final class CassandraDataCentersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraDataCenters() + .define("dc1") + .withExistingCassandraCluster("cassandra-prod-rg", "cassandra-prod") + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersDeleteSamples.java new file mode 100644 index 0000000000000..e4929cf6d8c75 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Delete. */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().delete("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersGetSamples.java new file mode 100644 index 0000000000000..b90d84674ecbe --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Get. */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().getWithResponse("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersListSamples.java new file mode 100644 index 0000000000000..61689f743d0be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters List. */ +public final class CassandraDataCentersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterList.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraDataCenters().list("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersUpdateSamples.java new file mode 100644 index 0000000000000..c64aaa58face7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraDataCentersUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResource; +import com.azure.resourcemanager.cosmos.generated.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters Update. */ +public final class CassandraDataCentersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBManagedCassandraDataCenterUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + DataCenterResource resource = + manager + .cassandraDataCenters() + .getWithResponse("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")) + .apply(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..7b4a33d4142f6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraKeyspace. */ +public final class CassandraResourcesCreateUpdateCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraKeyspace("keyspaceName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new CassandraKeyspaceResource().withId("keyspaceName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java new file mode 100644 index 0000000000000..42271e0b2a465 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CassandraPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CassandraSchema; +import com.azure.resourcemanager.cosmos.generated.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.generated.models.ClusterKey; +import com.azure.resourcemanager.cosmos.generated.models.Column; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraTable. */ +public final class CassandraResourcesCreateUpdateCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraTable("tableName") + .withRegion("West US") + .withExistingCassandraKeyspace("rg1", "ddb1", "keyspaceName") + .withResource( + new CassandraTableResource() + .withId("tableName") + .withDefaultTtl(100) + .withSchema( + new CassandraSchema() + .withColumns(Arrays.asList(new Column().withName("columnA").withType("Ascii"))) + .withPartitionKeys(Arrays.asList(new CassandraPartitionKey().withName("columnA"))) + .withClusterKeys(Arrays.asList(new ClusterKey().withName("columnA").withOrderBy("Asc")))) + .withAnalyticalStorageTtl(500)) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraViewSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraViewSamples.java new file mode 100644 index 0000000000000..39ddbe4ed7c99 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesCreateUpdateCassandraViewSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CassandraViewResource; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraView. */ +public final class CassandraResourcesCreateUpdateCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraViewCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .defineUpdateCassandraView("viewname") + .withRegion((String) null) + .withExistingCassandraKeyspace("rg1", "ddb1", "keyspacename") + .withResource( + new CassandraViewResource() + .withId("viewname") + .withViewDefinition( + "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND" + + " columnc IS NOT NULL PRIMARY (columnc, columna)")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..6413a00cd8dd5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraKeyspace. */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceDelete.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraKeyspace("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraTableSamples.java new file mode 100644 index 0000000000000..92b9836eb092b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraTableSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraTable. */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableDelete.json + */ + /** + * Sample code: CosmosDBCassandraTableDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraTable("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraViewSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraViewSamples.java new file mode 100644 index 0000000000000..04d494df2d31e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesDeleteCassandraViewSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraView. */ +public final class CassandraResourcesDeleteCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewDelete.json + */ + /** + * Sample code: CosmosDBCassandraViewDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().deleteCassandraView("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..ef83cb6b5a405 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspace. */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().getCassandraKeyspaceWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java new file mode 100644 index 0000000000000..b1149848ccef6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspaceThroughput. */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraKeyspaceThroughputWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableSamples.java new file mode 100644 index 0000000000000..59495700c41d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTable. */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableGet.json + */ + /** + * Sample code: CosmosDBCassandraTableGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraTableWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableThroughputSamples.java new file mode 100644 index 0000000000000..54af312f41f45 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraTableThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTableThroughput. */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraTableThroughputWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewSamples.java new file mode 100644 index 0000000000000..b03d483c314da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraView. */ +public final class CassandraResourcesGetCassandraViewSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewGet.json + */ + /** + * Sample code: CosmosDBCassandraViewGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraViewWithResponse("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewThroughputSamples.java new file mode 100644 index 0000000000000..c5202cd9f62c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesGetCassandraViewThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraViewThroughput. */ +public final class CassandraResourcesGetCassandraViewThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraViewThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .getCassandraViewThroughputWithResponse("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraKeyspacesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraKeyspacesSamples.java new file mode 100644 index 0000000000000..1a8679ac04408 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraKeyspacesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraKeyspaces. */ +public final class CassandraResourcesListCassandraKeyspacesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceList.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraKeyspaces("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraTablesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraTablesSamples.java new file mode 100644 index 0000000000000..a6e4708d5f64e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraTablesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraTables. */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableList.json + */ + /** + * Sample code: CosmosDBCassandraTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraTables("rgName", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraViewsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraViewsSamples.java new file mode 100644 index 0000000000000..88903895c883b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesListCassandraViewsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraViews. */ +public final class CassandraResourcesListCassandraViewsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewList.json + */ + /** + * Sample code: CosmosDBCassandraViewList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().listCassandraViews("rgName", "ddb1", "keyspacename", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java new file mode 100644 index 0000000000000..334e4c330d9ed --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.cassandraResources().migrateCassandraKeyspaceToAutoscale("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java new file mode 100644 index 0000000000000..7129f31f53f54 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraKeyspaceToManualThroughput("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java new file mode 100644 index 0000000000000..7360afe122d49 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToAutoscale. */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraTableToAutoscale("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java new file mode 100644 index 0000000000000..7d17f58447225 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraTableToManualThroughput("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToAutoscaleSamples.java new file mode 100644 index 0000000000000..77815e876bf11 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToAutoscaleSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraViewToAutoscale. */ +public final class CassandraResourcesMigrateCassandraViewToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraViewMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraViewToAutoscale("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToManualThroughputSamples.java new file mode 100644 index 0000000000000..fd6732973c019 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesMigrateCassandraViewToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraViewToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraViewToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraViewMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .migrateCassandraViewToManualThroughput("rg1", "ddb1", "keyspacename", "viewname", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.java new file mode 100644 index 0000000000000..d08dffd356a97 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraKeyspaceThroughput. */ +public final class CassandraResourcesUpdateCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraKeyspaceThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraKeyspaceThroughput( + "rg1", + "ddb1", + "keyspaceName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java new file mode 100644 index 0000000000000..d51ecf23c8788 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraTableThroughput. */ +public final class CassandraResourcesUpdateCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraTableThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraTableThroughput( + "rg1", + "ddb1", + "keyspaceName", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraViewThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraViewThroughputSamples.java new file mode 100644 index 0000000000000..6635afa56f4d3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CassandraResourcesUpdateCassandraViewThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraViewThroughput. */ +public final class CassandraResourcesUpdateCassandraViewThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCassandraViewThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraViewThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCassandraViewThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .cassandraResources() + .updateCassandraViewThroughput( + "rg1", + "ddb1", + "keyspacename", + "viewname", + new ThroughputSettingsUpdateParameters() + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..9a0f8ab0bcdb5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListMetricDefinitions. */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBCollectionGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.collections().listMetricDefinitions("rg1", "ddb1", "databaseRid", "collectionRid", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricsSamples.java new file mode 100644 index 0000000000000..7bbf1c729e8ce --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListMetricsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListMetrics. */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBCollectionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collections() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListUsagesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListUsagesSamples.java new file mode 100644 index 0000000000000..40a688f1cb833 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionListUsagesSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListUsages. */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collections() + .listUsages("rg1", "ddb1", "databaseRid", "collectionRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListMetricsSamples.java new file mode 100644 index 0000000000000..165c5d9885f0b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListMetricsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListMetrics. */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitions() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListUsagesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListUsagesSamples.java new file mode 100644 index 0000000000000..07f29c6e84063 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionListUsagesSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListUsages. */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitions() + .listUsages( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=name.value eq 'Partition Storage'", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionRegionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionRegionListMetricsSamples.java new file mode 100644 index 0000000000000..6bc19b0668e55 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionPartitionRegionListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartitionRegion ListMetrics. */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBCollectionPartitionRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionPartitionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionRegionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionRegionListMetricsSamples.java new file mode 100644 index 0000000000000..84799f7d5e177 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/CollectionRegionListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionRegion ListMetrics. */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRegionCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBRegionCollectionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRegionCollectionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .collectionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountRegionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountRegionListMetricsSamples.java new file mode 100644 index 0000000000000..6505e822f9c38 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountRegionListMetricsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccountRegion ListMetrics. */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccountRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCheckNameExistsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCheckNameExistsSamples.java new file mode 100644 index 0000000000000..7b81b559b94f2 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCheckNameExistsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts CheckNameExists. */ +public final class DatabaseAccountsCheckNameExistsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCheckNameExists. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCheckNameExists( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().checkNameExistsWithResponse("ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCreateOrUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ea38dfa736086 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsCreateOrUpdateSamples.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.generated.models.ApiProperties; +import com.azure.resourcemanager.cosmos.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.generated.models.CreateMode; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.generated.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.Location; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.generated.models.RestoreMode; +import com.azure.resourcemanager.cosmos.generated.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.generated.models.ServerVersion; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts CreateOrUpdate. */ +public final class DatabaseAccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json + */ + /** + * Sample code: CosmosDBRestoreDatabaseAccountCreateUpdate.json. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestoreDatabaseAccountCreateUpdateJson( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withCreateMode(CreateMode.RESTORE) + .withTags(mapOf()) + .withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withBackupPolicy(new ContinuousModeBackupPolicy()) + .withRestoreParameters( + new RestoreParameters() + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withDatabasesToRestore( + Arrays + .asList( + new DatabaseRestoreResourceInner() + .withDatabaseName("db1") + .withCollectionNames(Arrays.asList("collection1", "collection2")), + new DatabaseRestoreResourceInner() + .withDatabaseName("db2") + .withCollectionNames(Arrays.asList("collection3", "collection4"))))) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCreateMax.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMax. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCreateMax( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false), + new Location().withLocationName("eastus").withFailoverPriority(1).withIsZoneRedundant(false))) + .withCreateMode(CreateMode.DEFAULT) + .withTags(mapOf()) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withKind(DatabaseAccountKind.MONGO_DB) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withDefaultIdentity("FirstPartyIdentity") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(8) + .withBackupStorageRedundancy(BackupStorageRedundancy.GEO))) + .withCors(Arrays.asList(new CorsPolicy().withAllowedOrigins("https://test"))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountCreateMin.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMin. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountCreateMin( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .define("ddb1") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withCreateMode(CreateMode.DEFAULT) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsDeleteSamples.java new file mode 100644 index 0000000000000..f515c12c1ea79 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts Delete. */ +public final class DatabaseAccountsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountDelete.json + */ + /** + * Sample code: CosmosDBDatabaseAccountDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().delete("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsFailoverPriorityChangeSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsFailoverPriorityChangeSamples.java new file mode 100644 index 0000000000000..9a98dcd002a96 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsFailoverPriorityChangeSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.generated.models.FailoverPolicy; +import java.util.Arrays; + +/** Samples for DatabaseAccounts FailoverPriorityChange. */ +public final class DatabaseAccountsFailoverPriorityChangeSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json + */ + /** + * Sample code: CosmosDBDatabaseAccountFailoverPriorityChange. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountFailoverPriorityChange( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .failoverPriorityChange( + "rg1", + "ddb1-failover", + new FailoverPolicies() + .withFailoverPolicies( + Arrays + .asList( + new FailoverPolicy().withLocationName("eastus").withFailoverPriority(0), + new FailoverPolicy().withLocationName("westus").withFailoverPriority(1))), + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetByResourceGroupSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c1a8df1b1d76f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetByResourceGroup. */ +public final class DatabaseAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetReadOnlyKeysSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetReadOnlyKeysSamples.java new file mode 100644 index 0000000000000..931f9d631d184 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsGetReadOnlyKeysSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetReadOnlyKeys. */ +public final class DatabaseAccountsGetReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().getReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListByResourceGroupSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d35429fcc6fa9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListByResourceGroup. */ +public final class DatabaseAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListByResourceGroup. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListByResourceGroup( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListConnectionStringsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListConnectionStringsSamples.java new file mode 100644 index 0000000000000..6475aeed9e817 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListConnectionStringsSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListConnectionStrings. */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStrings. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListConnectionStrings( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listConnectionStringsWithResponse("rg1", "ddb1", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStringsMongo. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListConnectionStringsMongo( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listConnectionStringsWithResponse("rg1", "mongo-ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListKeysSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListKeysSamples.java new file mode 100644 index 0000000000000..790a7e6e01660 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListKeysSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListKeys. */ +public final class DatabaseAccountsListKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..3d83032a4f36b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetricDefinitions. */ +public final class DatabaseAccountsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listMetricDefinitions("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricsSamples.java new file mode 100644 index 0000000000000..eb21028041920 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetrics. */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListReadOnlyKeysSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListReadOnlyKeysSamples.java new file mode 100644 index 0000000000000..d0120ef8ae14b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListReadOnlyKeysSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListReadOnlyKeys. */ +public final class DatabaseAccountsListReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListSamples.java new file mode 100644 index 0000000000000..f19023b4b0896 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts List. */ +public final class DatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBDatabaseAccountList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().list(Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListUsagesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListUsagesSamples.java new file mode 100644 index 0000000000000..defbe00370336 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsListUsagesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListUsages. */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountGetUsages( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().listUsages("rg1", "ddb1", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOfflineRegionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOfflineRegionSamples.java new file mode 100644 index 0000000000000..a2855dac324cb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOfflineRegionSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OfflineRegion. */ +public final class DatabaseAccountsOfflineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOfflineRegion. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountOfflineRegion( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().offlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOnlineRegionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOnlineRegionSamples.java new file mode 100644 index 0000000000000..0487d33800e0a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsOnlineRegionSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OnlineRegion. */ +public final class DatabaseAccountsOnlineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOnlineRegion. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountOnlineRegion( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databaseAccounts().onlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsRegenerateKeySamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsRegenerateKeySamples.java new file mode 100644 index 0000000000000..ec8aebe614a18 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsRegenerateKeySamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.generated.models.KeyKind; + +/** Samples for DatabaseAccounts RegenerateKey. */ +public final class DatabaseAccountsRegenerateKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegenerateKey. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegenerateKey( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databaseAccounts() + .regenerateKey( + "rg1", "ddb1", new DatabaseAccountRegenerateKeyParameters().withKeyKind(KeyKind.PRIMARY), Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsUpdateSamples.java new file mode 100644 index 0000000000000..941af7ca77ff8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseAccountsUpdateSamples.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.generated.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.generated.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.generated.models.DatabaseAccountGetResults; +import com.azure.resourcemanager.cosmos.generated.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.generated.models.DiagnosticLogSettings; +import com.azure.resourcemanager.cosmos.generated.models.EnableFullTextQuery; +import com.azure.resourcemanager.cosmos.generated.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.generated.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.generated.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.generated.models.VirtualNetworkRule; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts Update. */ +public final class DatabaseAccountsUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseAccountPatch.json + */ + /** + * Sample code: CosmosDBDatabaseAccountPatch. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountPatch( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + DatabaseAccountGetResults resource = + manager.databaseAccounts().getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("dept", "finance")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withDefaultIdentity("FirstPartyIdentity") + .withEnableFreeTier(false) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(720) + .withBackupStorageRedundancy(BackupStorageRedundancy.GEO))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withDiagnosticLogSettings(new DiagnosticLogSettings().withEnableFullTextQuery(EnableFullTextQuery.TRUE)) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..796f339495162 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListMetricDefinitions. */ +public final class DatabaseListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetricDefinitions. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetMetricDefinitions( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databases().listMetricDefinitions("rg1", "ddb1", "databaseRid", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricsSamples.java new file mode 100644 index 0000000000000..03cfc7864a02f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListMetrics. */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetMetrics(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .databases() + .listMetrics( + "rg1", + "ddb1", + "rid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListUsagesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListUsagesSamples.java new file mode 100644 index 0000000000000..2cecd5375bdd1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/DatabaseListUsagesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListUsages. */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDatabaseGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseGetUsages. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseGetUsages(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.databases().listUsages("rg1", "ddb1", "databaseRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesCreateUpdateGraphSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesCreateUpdateGraphSamples.java new file mode 100644 index 0000000000000..cd2c1df9fa86d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesCreateUpdateGraphSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GraphResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GraphResources CreateUpdateGraph. */ +public final class GraphResourcesCreateUpdateGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceCreateUpdate.json + */ + /** + * Sample code: CosmosDBGraphCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGraphCreateUpdate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .graphResources() + .define("graphName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new GraphResource().withId("graphName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesDeleteGraphResourceSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesDeleteGraphResourceSamples.java new file mode 100644 index 0000000000000..9763bd00fd326 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesDeleteGraphResourceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GraphResources DeleteGraphResource. */ +public final class GraphResourcesDeleteGraphResourceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceDelete.json + */ + /** + * Sample code: CosmosDBSqlDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().deleteGraphResource("rg1", "ddb1", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesGetGraphSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesGetGraphSamples.java new file mode 100644 index 0000000000000..e7e27b70355a6 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesGetGraphSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GraphResources GetGraph. */ +public final class GraphResourcesGetGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().getGraphWithResponse("rg1", "ddb1", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesListGraphsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesListGraphsSamples.java new file mode 100644 index 0000000000000..7a05ec241284c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GraphResourcesListGraphsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GraphResources ListGraphs. */ +public final class GraphResourcesListGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphResourceList.json + */ + /** + * Sample code: CosmosDBSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.graphResources().listGraphs("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..8a18db3a82917 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.GremlinDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinDatabase. */ +public final class GremlinResourcesCreateUpdateGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .defineUpdateGremlinDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new GremlinDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java new file mode 100644 index 0000000000000..956f7bfdacf27 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.DataType; +import com.azure.resourcemanager.cosmos.generated.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.generated.models.IncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.IndexKind; +import com.azure.resourcemanager.cosmos.generated.models.Indexes; +import com.azure.resourcemanager.cosmos.generated.models.IndexingMode; +import com.azure.resourcemanager.cosmos.generated.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKind; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKey; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinGraph. */ +public final class GremlinResourcesCreateUpdateGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .defineUpdateGremlinGraph("graphName") + .withRegion("West US") + .withExistingGremlinDatabase("rg1", "ddb1", "databaseName") + .withResource( + new GremlinGraphResource() + .withId("graphName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys(Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..04075aeb1ee66 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinDatabase. */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseDelete.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().deleteGremlinDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinGraphSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinGraphSamples.java new file mode 100644 index 0000000000000..25eb7e1658432 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesDeleteGremlinGraphSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinGraph. */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphDelete.json + */ + /** + * Sample code: CosmosDBGremlinGraphDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().deleteGremlinGraph("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..aa4387cd0e41a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabase. */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().getGremlinDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..c38b296ed2a19 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabaseThroughput. */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphSamples.java new file mode 100644 index 0000000000000..c3e53f96d338f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraph. */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinGraphWithResponse("rgName", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java new file mode 100644 index 0000000000000..0f1c0c6cc09c5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraphThroughput. */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .getGremlinGraphThroughputWithResponse("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinDatabasesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinDatabasesSamples.java new file mode 100644 index 0000000000000..3956d7a6820af --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinDatabasesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinDatabases. */ +public final class GremlinResourcesListGremlinDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseList.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().listGremlinDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinGraphsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinGraphsSamples.java new file mode 100644 index 0000000000000..ed7df59cb9960 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesListGremlinGraphsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinGraphs. */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphList.json + */ + /** + * Sample code: CosmosDBGremlinGraphList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().listGremlinGraphs("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..4bb9c4f83fc65 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.gremlinResources().migrateGremlinDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..02b6c69ffe657 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java new file mode 100644 index 0000000000000..c91beca16e0dc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToAutoscale. */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinGraphToAutoscale("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java new file mode 100644 index 0000000000000..ce0dfefb69c61 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .migrateGremlinGraphToManualThroughput("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..266ac61b8b7da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinDatabaseThroughput. */ +public final class GremlinResourcesUpdateGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .updateGremlinDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java new file mode 100644 index 0000000000000..688885d9bd449 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinGraphThroughput. */ +public final class GremlinResourcesUpdateGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBGremlinGraphThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .gremlinResources() + .updateGremlinGraphThroughput( + "rg1", + "ddb1", + "databaseName", + "graphName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..8efea5a3b6495 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBCollectionResource; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndex; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndexKeys; +import com.azure.resourcemanager.cosmos.generated.models.MongoIndexOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBCollection. */ +public final class MongoDBResourcesCreateUpdateMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .defineUpdateMongoDBCollection("collectionName") + .withRegion("West US") + .withExistingMongodbDatabase("rg1", "ddb1", "databaseName") + .withResource( + new MongoDBCollectionResource() + .withId("collectionName") + .withShardKey(mapOf("testKey", "Hash")) + .withIndexes( + Arrays + .asList( + new MongoIndex() + .withKey(new MongoIndexKeys().withKeys(Arrays.asList("_ts"))) + .withOptions(new MongoIndexOptions().withExpireAfterSeconds(100).withUnique(true)), + new MongoIndex().withKey(new MongoIndexKeys().withKeys(Arrays.asList("_id"))))) + .withAnalyticalStorageTtl(500)) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..39c5a5694bfbb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.MongoDBDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBDatabase. */ +public final class MongoDBResourcesCreateUpdateMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .defineUpdateMongoDBDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new MongoDBDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..608daa58802c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBCollection. */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .deleteMongoDBCollection("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..9fb94bf4893b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBDatabase. */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseDelete.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().deleteMongoDBDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..10f73c405c728 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollection. */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBCollectionWithResponse("rgName", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java new file mode 100644 index 0000000000000..f726d1a7d87be --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollectionThroughput. */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBCollectionThroughputWithResponse("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..7c44cf6502482 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabase. */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().getMongoDBDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..7bf81d21344ab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .getMongoDBDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBCollectionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBCollectionsSamples.java new file mode 100644 index 0000000000000..1427c4af63704 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBCollectionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBCollections. */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionList.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().listMongoDBCollections("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBDatabasesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBDatabasesSamples.java new file mode 100644 index 0000000000000..44ac3f554b2b8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesListMongoDBDatabasesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBDatabases. */ +public final class MongoDBResourcesListMongoDBDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseList.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().listMongoDBDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java new file mode 100644 index 0000000000000..9ab855f801d0b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBCollectionToAutoscale("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java new file mode 100644 index 0000000000000..61c414be3757c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBCollectionToManualThroughput("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..9fa034e5e2c4c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.mongoDBResources().migrateMongoDBDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..260e4c63bd05c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .migrateMongoDBDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java new file mode 100644 index 0000000000000..934804b3d929c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBCollectionThroughput. */ +public final class MongoDBResourcesUpdateMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBCollectionThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .updateMongoDBCollectionThroughput( + "rg1", + "ddb1", + "databaseName", + "collectionName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..930901f44d15a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBMongoDBDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .mongoDBResources() + .updateMongoDBDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesCreateOrUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..67a9b3362293f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces CreateOrUpdate. */ +public final class NotebookWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceCreate.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .notebookWorkspaces() + .define(NotebookWorkspaceName.DEFAULT) + .withExistingDatabaseAccount("rg1", "ddb1") + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesDeleteSamples.java new file mode 100644 index 0000000000000..25f2e8007a69d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Delete. */ +public final class NotebookWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceDelete.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().delete("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesGetSamples.java new file mode 100644 index 0000000000000..5e976726e5bc1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Get. */ +public final class NotebookWorkspacesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceGet.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().getWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListByDatabaseAccountSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..630b901e6b994 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListByDatabaseAccountSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for NotebookWorkspaces ListByDatabaseAccount. */ +public final class NotebookWorkspacesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceList.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListConnectionInfoSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListConnectionInfoSamples.java new file mode 100644 index 0000000000000..b98200dd0253b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesListConnectionInfoSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces ListConnectionInfo. */ +public final class NotebookWorkspacesListConnectionInfoSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceListConnectionInfo. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceListConnectionInfo( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .notebookWorkspaces() + .listConnectionInfoWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java new file mode 100644 index 0000000000000..2fb2bed960f87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces RegenerateAuthToken. */ +public final class NotebookWorkspacesRegenerateAuthTokenSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceRegenerateAuthToken. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceRegenerateAuthToken( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().regenerateAuthToken("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesStartSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesStartSamples.java new file mode 100644 index 0000000000000..a0c95883aec71 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/NotebookWorkspacesStartSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Start. */ +public final class NotebookWorkspacesStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBNotebookWorkspaceStart.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceStart. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBNotebookWorkspaceStart( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.notebookWorkspaces().start("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/OperationsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..dd79446273b7c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBOperationsList.json + */ + /** + * Sample code: CosmosDBOperationsList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBOperationsList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdListMetricsSamples.java new file mode 100644 index 0000000000000..897aab9921e2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeId ListMetrics. */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPKeyRangeIdGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .partitionKeyRangeIds() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdRegionListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdRegionListMetricsSamples.java new file mode 100644 index 0000000000000..cd6ff4e34340a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PartitionKeyRangeIdRegionListMetricsSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeIdRegion ListMetrics. */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .partitionKeyRangeIdRegions() + .listMetrics( + "rg1", + "ddb1", + "West US", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileListMetricsSamples.java new file mode 100644 index 0000000000000..968a1ee44c248 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Percentile ListMetrics. */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentiles() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileSourceTargetListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileSourceTargetListMetricsSamples.java new file mode 100644 index 0000000000000..d34a1f93beade --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileSourceTargetListMetricsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PercentileSourceTarget ListMetrics. */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileSourceTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentileSourceTargets() + .listMetrics( + "rg1", + "ddb1", + "West Central US", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileTargetListMetricsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileTargetListMetricsSamples.java new file mode 100644 index 0000000000000..af6d51103bbeb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PercentileTargetListMetricsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PercentileTarget ListMetrics. */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPercentileTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .percentileTargets() + .listMetrics( + "rg1", + "ddb1", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dde1f9b24da53 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .privateEndpointConnections() + .define("privateEndpointConnectionName") + .withExistingDatabaseAccount("rg1", "ddb1") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..ee115845aa6f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateEndpointConnections().delete("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..3f80e0c3cbe6c --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..4f61eddc2a01e --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByDatabaseAccount. */ +public final class PrivateEndpointConnectionsListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateEndpointConnections().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..de64b20bd5dc3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateLinkResources().getWithResponse("rg1", "ddb1", "sql", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..0c1f25ac5a492 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByDatabaseAccount. */ +public final class PrivateLinkResourcesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBPrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.privateLinkResources().listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderListSamples.java new file mode 100644 index 0000000000000..f59236c247348 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider List. */ +public final class ResourceProviderListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBLocationList.json + */ + /** + * Sample code: CosmosDBLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.resourceProviders().list(Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderLocationGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderLocationGetSamples.java new file mode 100644 index 0000000000000..6b9f1777f8424 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ResourceProviderLocationGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider LocationGet. */ +public final class ResourceProviderLocationGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBLocationGet.json + */ + /** + * Sample code: CosmosDBLocationGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBLocationGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.resourceProviders().locationGetWithResponse("westus", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsGetByLocationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsGetByLocationSamples.java new file mode 100644 index 0000000000000..49f3db0364eea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsGetByLocationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts GetByLocation. */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableDatabaseAccounts() + .getByLocationWithResponse("West US", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListByLocationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListByLocationSamples.java new file mode 100644 index 0000000000000..07e7bba8de543 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts ListByLocation. */ +public final class RestorableDatabaseAccountsListByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableDatabaseAccounts().listByLocation("West US", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListSamples.java new file mode 100644 index 0000000000000..a9141ceb15879 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableDatabaseAccountsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts List. */ +public final class RestorableDatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountNoLocationList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableDatabaseAccountNoLocationList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableDatabaseAccounts().list(Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbCollectionsListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbCollectionsListSamples.java new file mode 100644 index 0000000000000..427ec9c4e8785 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbCollectionsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbCollections List. */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbCollectionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbCollectionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableMongodbCollections() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbDatabasesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbDatabasesListSamples.java new file mode 100644 index 0000000000000..9b5c4698ce3ea --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbDatabasesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbDatabases List. */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbDatabaseList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableMongodbDatabases().list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbResourcesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbResourcesListSamples.java new file mode 100644 index 0000000000000..7fc23b0ad8e53 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableMongodbResourcesListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbResources List. */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableMongodbResourceList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableMongodbResourceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableMongodbResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlContainersListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlContainersListSamples.java new file mode 100644 index 0000000000000..9a215d3452d09 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlContainersListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlContainers List. */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlContainerList.json + */ + /** + * Sample code: CosmosDBRestorableSqlContainerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlContainerList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableSqlContainers() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "3fu-hg==", null, null, Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlDatabasesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlDatabasesListSamples.java new file mode 100644 index 0000000000000..73b58d3b413bd --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlDatabasesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlDatabases List. */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlDatabaseList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.restorableSqlDatabases().list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlResourcesListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlResourcesListSamples.java new file mode 100644 index 0000000000000..39b88c60dcc9f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/RestorableSqlResourcesListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlResources List. */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBRestorableSqlResourceList.json + */ + /** + * Sample code: CosmosDBRestorableSqlResourceList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBRestorableSqlResourceList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .restorableSqlResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceCreateSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceCreateSamples.java new file mode 100644 index 0000000000000..98802bac2f7a3 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceCreateSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ServiceSize; +import com.azure.resourcemanager.cosmos.generated.models.ServiceType; + +/** Samples for Service Create. */ +public final class ServiceCreateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("SqlDedicatedGateway") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.SQL_DEDICATED_GATEWAY) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceCreate.json + */ + /** + * Sample code: DataTransferServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceCreate(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("DataTransfer") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.DATA_TRANSFER) + .create(); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + */ + /** + * Sample code: GraphAPIComputeServiceCreate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceCreate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .services() + .define("GraphAPICompute") + .withExistingDatabaseAccount("rg1", "ddb1") + .withInstanceSize(ServiceSize.COSMOS_D4S) + .withInstanceCount(1) + .withServiceType(ServiceType.GRAPH_APICOMPUTE) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.java new file mode 100644 index 0000000000000..108c72503a6bb --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceDeleteSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Service Delete. */ +public final class ServiceDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "SqlDedicatedGateway", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceDelete.json + */ + /** + * Sample code: DataTransferServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "DataTransfer", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json + */ + /** + * Sample code: GraphAPIComputeServiceDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().delete("rg1", "ddb1", "GraphAPICompute", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceGetSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceGetSamples.java new file mode 100644 index 0000000000000..128c9f56798c1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceGetSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Service Get. */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBDataTransferServiceGet.json + */ + /** + * Sample code: DataTransferServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void dataTransferServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "DataTransfer", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + */ + /** + * Sample code: GraphAPIComputeServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void graphAPIComputeServiceGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "GraphAPICompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + */ + /** + * Sample code: SqlDedicatedGatewayServiceGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void sqlDedicatedGatewayServiceGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().getWithResponse("rg1", "ddb1", "SqlDedicatedGateway", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceListSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceListSamples.java new file mode 100644 index 0000000000000..e42e1d70ed8e5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/ServiceListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Service List. */ +public final class ServiceListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBServicesList.json + */ + /** + * Sample code: CosmosDBServicesList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBServicesList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.services().list("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlContainerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlContainerSamples.java new file mode 100644 index 0000000000000..3a8be44033e87 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlContainerSamples.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.generated.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.generated.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.DataType; +import com.azure.resourcemanager.cosmos.generated.models.IncludedPath; +import com.azure.resourcemanager.cosmos.generated.models.IndexKind; +import com.azure.resourcemanager.cosmos.generated.models.Indexes; +import com.azure.resourcemanager.cosmos.generated.models.IndexingMode; +import com.azure.resourcemanager.cosmos.generated.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.generated.models.PartitionKind; +import com.azure.resourcemanager.cosmos.generated.models.SqlContainerResource; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKey; +import com.azure.resourcemanager.cosmos.generated.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlContainer. */ +public final class SqlResourcesCreateUpdateSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlContainer("containerName") + .withRegion("West US") + .withExistingSqlDatabase("rg1", "ddb1", "databaseName") + .withResource( + new SqlContainerResource() + .withId("containerName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys(Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java new file mode 100644 index 0000000000000..dbda6e0f0cd7a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlDatabase. */ +public final class SqlResourcesCreateUpdateSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlDatabase("databaseName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new SqlDatabaseResource().withId("databaseName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..54d2096d50c5a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +/** Samples for SqlResources CreateUpdateSqlRoleAssignment. */ +public final class SqlResourcesCreateUpdateSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlRoleAssignment("myRoleAssignmentId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleDefinitionId( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId") + .withScope( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases") + .withPrincipalId("myPrincipalId") + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..5dd3e6f576810 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.Permission; +import com.azure.resourcemanager.cosmos.generated.models.RoleDefinitionType; +import java.util.Arrays; + +/** Samples for SqlResources CreateUpdateSqlRoleDefinition. */ +public final class SqlResourcesCreateUpdateSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlRoleDefinition("myRoleDefinitionId") + .withExistingDatabaseAccount("myResourceGroupName", "myAccountName") + .withRoleName("myRoleName") + .withType(RoleDefinitionType.CUSTOM_ROLE) + .withAssignableScopes( + Arrays + .asList( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")) + .withPermissions( + Arrays + .asList( + new Permission() + .withDataActions( + Arrays + .asList( + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create", + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")) + .withNotDataActions(Arrays.asList()))) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..83efd00eab43f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlStoredProcedureResource; + +/** Samples for SqlResources CreateUpdateSqlStoredProcedure. */ +public final class SqlResourcesCreateUpdateSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlStoredProcedure("storedProcedureName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource(new SqlStoredProcedureResource().withId("storedProcedureName").withBody("body")) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java new file mode 100644 index 0000000000000..53b4be6cff2e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlTriggerResource; +import com.azure.resourcemanager.cosmos.generated.models.TriggerOperation; +import com.azure.resourcemanager.cosmos.generated.models.TriggerType; + +/** Samples for SqlResources CreateUpdateSqlTrigger. */ +public final class SqlResourcesCreateUpdateSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlTriggerCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlTrigger("triggerName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource( + new SqlTriggerResource() + .withId("triggerName") + .withBody("body") + .withTriggerType(TriggerType.fromString("triggerType")) + .withTriggerOperation(TriggerOperation.fromString("triggerOperation"))) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..5e9d8ec1ac378 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.SqlUserDefinedFunctionResource; + +/** Samples for SqlResources CreateUpdateSqlUserDefinedFunction. */ +public final class SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionCreateUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionCreateUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .defineUpdateSqlUserDefinedFunction("userDefinedFunctionName") + .withRegion((String) null) + .withExistingContainer("rg1", "ddb1", "databaseName", "containerName") + .withResource(new SqlUserDefinedFunctionResource().withId("userDefinedFunctionName").withBody("body")) + .withOptions(new CreateUpdateOptions()) + .create(); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlContainerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlContainerSamples.java new file mode 100644 index 0000000000000..56f421dda1414 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlContainerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlContainer. */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerDelete.json + */ + /** + * Sample code: CosmosDBSqlContainerDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().deleteSqlContainer("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlDatabaseSamples.java new file mode 100644 index 0000000000000..32c437ef4b8cc --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlDatabase. */ +public final class SqlResourcesDeleteSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseDelete.json + */ + /** + * Sample code: CosmosDBSqlDatabaseDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().deleteSqlDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..b6b3c3aec02f7 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleAssignment. */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlRoleAssignment("myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..869a07d5ede6b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleDefinition. */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlRoleDefinition("myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..af2c5fc692c64 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlStoredProcedure. */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureDelete.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlStoredProcedure( + "rg1", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlTriggerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlTriggerSamples.java new file mode 100644 index 0000000000000..9080f8d1caf2a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlTriggerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlTrigger. */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerDelete.json + */ + /** + * Sample code: CosmosDBSqlTriggerDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlTrigger("rg1", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..ba6ef76ebcb19 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlUserDefinedFunction. */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionDelete( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .deleteSqlUserDefinedFunction( + "rg1", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerSamples.java new file mode 100644 index 0000000000000..8fa271602af46 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainer. */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerGet.json + */ + /** + * Sample code: CosmosDBSqlContainerGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlContainerWithResponse("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerThroughputSamples.java new file mode 100644 index 0000000000000..f9fdb9f5be401 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlContainerThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainerThroughput. */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlContainerThroughputWithResponse("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseSamples.java new file mode 100644 index 0000000000000..f94b967afd62b --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabase. */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().getSqlDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..a3e3f06c31c19 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabaseThroughput. */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseThroughputGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().getSqlDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleAssignmentSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..480e30d5cc21a --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleAssignmentSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleAssignment. */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentGet.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlRoleAssignmentWithResponse( + "myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleDefinitionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..5f8ccd4da5513 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlRoleDefinitionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleDefinition. */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionGet.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlRoleDefinitionWithResponse( + "myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlStoredProcedureSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..c138c62f026fa --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlStoredProcedureSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlStoredProcedure. */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureGet.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlStoredProcedureWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlTriggerSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlTriggerSamples.java new file mode 100644 index 0000000000000..05406c7628a89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlTriggerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlTrigger. */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerGet.json + */ + /** + * Sample code: CosmosDBSqlTriggerGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlTriggerWithResponse("rgName", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..9f17d5552c07d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlUserDefinedFunction. */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionGet( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .getSqlUserDefinedFunctionWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlContainersSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlContainersSamples.java new file mode 100644 index 0000000000000..8c976ad06f1da --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlContainersSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlContainers. */ +public final class SqlResourcesListSqlContainersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerList.json + */ + /** + * Sample code: CosmosDBSqlContainerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlContainers("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlDatabasesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlDatabasesSamples.java new file mode 100644 index 0000000000000..031728e0ed9e1 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlDatabasesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlDatabases. */ +public final class SqlResourcesListSqlDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBSqlDatabaseList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleAssignmentsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleAssignmentsSamples.java new file mode 100644 index 0000000000000..07c27eb6169a0 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleAssignmentsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleAssignments. */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleAssignmentList.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleAssignmentList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlRoleAssignments("myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleDefinitionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleDefinitionsSamples.java new file mode 100644 index 0000000000000..cad4cf44e43b9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlRoleDefinitionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleDefinitions. */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlRoleDefinitionList.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlRoleDefinitionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlRoleDefinitions("myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlStoredProceduresSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlStoredProceduresSamples.java new file mode 100644 index 0000000000000..e16bfcdfe5f05 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlStoredProceduresSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlStoredProcedures. */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlStoredProcedureList.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlStoredProcedureList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlStoredProcedures("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlTriggersSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlTriggersSamples.java new file mode 100644 index 0000000000000..b3b88e19c3031 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlTriggersSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlTriggers. */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlTriggerList.json + */ + /** + * Sample code: CosmosDBSqlTriggerList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlTriggerList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().listSqlTriggers("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java new file mode 100644 index 0000000000000..bd461fceb80f5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlUserDefinedFunctions. */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlUserDefinedFunctionList.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlUserDefinedFunctionList( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .listSqlUserDefinedFunctions("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java new file mode 100644 index 0000000000000..b91a2bfe25d35 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToAutoscale. */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .migrateSqlContainerToAutoscale("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java new file mode 100644 index 0000000000000..f520dfd426ee5 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToManualThroughput. */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .migrateSqlContainerToManualThroughput("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..935ffd9781b02 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToAutoscale. */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().migrateSqlDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..555a313ebad89 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToManualThroughput. */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.sqlResources().migrateSqlDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..ca40377374b5f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ContinuousBackupRestoreLocation; + +/** Samples for SqlResources RetrieveContinuousBackupInformation. */ +public final class SqlResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBBackupInformation.json + */ + /** + * Sample code: CosmosDBSqlContainerBackupInformation. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerBackupInformation( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .retrieveContinuousBackupInformation( + "rgName", + "ddb1", + "databaseName", + "containerName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), + Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java new file mode 100644 index 0000000000000..ddf50a60f25c9 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlContainerThroughput. */ +public final class SqlResourcesUpdateSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlContainerThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlContainerThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .updateSqlContainerThroughput( + "rg1", + "ddb1", + "databaseName", + "containerName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..7f8bb71e2c820 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlDatabaseThroughput. */ +public final class SqlResourcesUpdateSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBSqlDatabaseThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .sqlResources() + .updateSqlDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesCreateUpdateTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesCreateUpdateTableSamples.java new file mode 100644 index 0000000000000..3739d56ded648 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesCreateUpdateTableSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.resourcemanager.cosmos.generated.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.generated.models.TableResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources CreateUpdateTable. */ +public final class TableResourcesCreateUpdateTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBTableReplace. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableReplace(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .tableResources() + .define("tableName") + .withRegion("West US") + .withExistingDatabaseAccount("rg1", "ddb1") + .withResource(new TableResource().withId("tableName")) + .withTags(mapOf()) + .withOptions(new CreateUpdateOptions()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesDeleteTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesDeleteTableSamples.java new file mode 100644 index 0000000000000..ef89886d04459 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesDeleteTableSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources DeleteTable. */ +public final class TableResourcesDeleteTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableDelete.json + */ + /** + * Sample code: CosmosDBTableDelete. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableDelete(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().deleteTable("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableSamples.java new file mode 100644 index 0000000000000..7acd0f0d3b44d --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources GetTable. */ +public final class TableResourcesGetTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableGet.json + */ + /** + * Sample code: CosmosDBTableGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().getTableWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableThroughputSamples.java new file mode 100644 index 0000000000000..daf4937a82aab --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesGetTableThroughputSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources GetTableThroughput. */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableThroughputGet.json + */ + /** + * Sample code: CosmosDBTableThroughputGet. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableThroughputGet(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().getTableThroughputWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesListTablesSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesListTablesSamples.java new file mode 100644 index 0000000000000..23b2f7d3aa7c8 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesListTablesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources ListTables. */ +public final class TableResourcesListTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableList.json + */ + /** + * Sample code: CosmosDBTableList. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableList(com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().listTables("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToAutoscaleSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToAutoscaleSamples.java new file mode 100644 index 0000000000000..ad0146922630f --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToAutoscaleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToAutoscale. */ +public final class TableResourcesMigrateTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBTableMigrateToAutoscale. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableMigrateToAutoscale( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().migrateTableToAutoscale("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToManualThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToManualThroughputSamples.java new file mode 100644 index 0000000000000..073112a84c8ef --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesMigrateTableToManualThroughputSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToManualThroughput. */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBTableMigrateToManualThroughput. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableMigrateToManualThroughput( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager.tableResources().migrateTableToManualThroughput("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesUpdateTableThroughputSamples.java b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesUpdateTableThroughputSamples.java new file mode 100644 index 0000000000000..4746e85f32f98 --- /dev/null +++ b/sdk/cosmos/azure-resourcemanager-cosmos-generated/src/samples/java/com/azure/resourcemanager/cosmos/generated/generated/TableResourcesUpdateTableThroughputSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.generated.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources UpdateTableThroughput. */ +public final class TableResourcesUpdateTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2021-07-01-preview/examples/CosmosDBTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBTableThroughputUpdate. + * + * @param manager Entry point to CosmosDBManager. + */ + public static void cosmosDBTableThroughputUpdate( + com.azure.resourcemanager.cosmos.generated.CosmosDBManager manager) { + manager + .tableResources() + .updateTableThroughput( + "rg1", + "ddb1", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/cosmos/ci.yml b/sdk/cosmos/ci.yml index 94499f05b585e..12790b7375d30 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -59,7 +59,7 @@ pr: - sdk/cosmos/azure-spring-data-cosmos-test/pom.xml extends: - template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml #NOTE: Non-standard template. + template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml parameters: ServiceDirectory: cosmos SDKType: client @@ -76,6 +76,9 @@ extends: - name: azure-cosmos-spark_3-1_2-12 groupId: com.azure.cosmos.spark safeName: azurecosmosspark3 + - name: azure-resourcemanager-cosmos-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercosmosgenerated AdditionalModules: - name: azure-cosmos-benchmark groupId: com.azure diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 4dee6ce51f605..b379fe45e9284 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -61,9 +61,10 @@ azure-cosmos-benchmark azure-cosmos-dotnet-benchmark azure-cosmos-encryption + azure-cosmos-spark_3-1_2-12 + azure-resourcemanager-cosmos-generated azure-spring-data-cosmos azure-spring-data-cosmos-test - azure-cosmos-spark_3-1_2-12